fix(#266): add midnight Oslo sync and safe cleanup of stale future sessions#267
Merged
Merged
Conversation
…e sessions Sporty's API ignores period_start and always returns sessions from tomorrow onwards, so same-day sessions could only ever be captured the night before. Adding a 22:00 UTC timer run (midnight Oslo CEST) ensures next-day sessions are captured while Sporty still treats them as "tomorrow". The sync now also deletes future gym_calendar rows within the sync window before each upsert, removing cancelled/rescheduled sessions that Sporty has dropped. The cleanup only runs when Sporty returns data (guards against API outages) and never touches rows before the next Oslo midnight (preserves same-day sessions from the 22:00 UTC run across later runs in the same day). Backfill runs (shiftDays != 0) skip the cleanup entirely. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
bc84879 to
3f1f36e
Compare
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://white-island-090dfd003-267.westeurope.7.azurestaticapps.net |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
period_startand always returns sessions from tomorrow onwards — same-day sessions can only be captured the night before while Sporty still treats them as "tomorrow"gym_calendarrows within the sync window before each upsert, removing cancelled/rescheduled sessions that Sporty has droppedshiftDays !== 0)Closes #266
Test plan
POST /api/sporty-syncmanually and confirmdeletedcount appears in logs alongsideupsertednpm testinapp/)sportySyncTimerto confirm the new 22:00 UTC slot fires🤖 Generated with Claude Code