fix: update calendar progress at daily reset #2365

Merged
Sainan merged 2 commits from refill-calendar into main 2025-06-30 13:28:28 -07:00

View File

@ -13,7 +13,8 @@ import {
allDailyAffiliationKeys, allDailyAffiliationKeys,
cleanupInventory, cleanupInventory,
createLibraryDailyTask, createLibraryDailyTask,
generateRewardSeed generateRewardSeed,
getCalendarProgress
} from "@/src/services/inventoryService"; } from "@/src/services/inventoryService";
import { logger } from "@/src/utils/logger"; import { logger } from "@/src/utils/logger";
import { addString, catBreadHash } from "@/src/helpers/stringHelpers"; import { addString, catBreadHash } from "@/src/helpers/stringHelpers";
@ -108,6 +109,10 @@ export const inventoryController: RequestHandler = async (request, response) =>
} }
} }
if (inventory.CalendarProgress) {
getCalendarProgress(inventory); // handle year rollover; the client expects to receive an inventory with an up-to-date CalendarProgress
}
cleanupInventory(inventory); cleanupInventory(inventory);
inventory.NextRefill = new Date((today + 1) * 86400000); // tomorrow at 0 UTC inventory.NextRefill = new Date((today + 1) * 86400000); // tomorrow at 0 UTC