diff --git a/data_backup.sh b/data_backup.sh index f82a115..63ce48f 100755 --- a/data_backup.sh +++ b/data_backup.sh @@ -12,6 +12,6 @@ dst_file="data-${timestamp}.db" mkdir -p $dst_dir # Move and rename the file -mv "${src}" "${dst_dir}/${dst_file}" +cp "${src}" "${dst_dir}/${dst_file}" echo "File has been moved to ${dst_dir} and renamed to ${dst_file}" \ No newline at end of file diff --git a/src/routes/transactions.zig b/src/routes/transactions.zig index 1214a79..9f231e4 100644 --- a/src/routes/transactions.zig +++ b/src/routes/transactions.zig @@ -13,11 +13,14 @@ pub fn fetchTransFromDb(allocator: std.mem.Allocator, family_id: u32) !?[]models var db = handler.getDb(); const now = time.Datetime.now(); var beginning_of_month = try time.Datetime.fromDate(now.date.year, now.date.month, 1); - const timezone_begin = beginning_of_month.shiftTimezone(&tz.US.Mountain); - // std.log.info("Beginning: {} Shifted: {}", .{ beginning_of_month.date.toTimestamp(), timezone_begin.date.toTimestamp() }); - const begin_time = @bitCast(u64, timezone_begin.date.toTimestamp()); + // const timezone_begin = beginning_of_month.shiftTimezone(&tz.US.Mountain); - // std.log.info("Fetching transactions after beginning of month: unix {}", .{begin_time}); + const timezone_begin = beginning_of_month.shiftHours(6); + // std.log.info("Beginning: {} Shifted: {}", .{ beginning_of_month.date.toTimestamp(), timezone_begin.date.toTimestamp() }); + // const unix = @bitCast(u64, beginning_of_month.date.toTimestamp() + beginning_of_month.time.toTimestamp()); + const begin_time = @bitCast(u64, timezone_begin.date.toTimestamp() + timezone_begin.time.toTimestamp()); + + // std.log.info("Fetching transactions after beginning of month: unix {}, adjusted {}", .{ unix, begin_time }); comptime { if (!std.mem.eql(u8, @typeInfo(models.Transaction).Struct.fields[7].name, "date")) { return error{TransactionModelError};