Keep appointment ids stable on incremental re-imports; report catalog changes - #37
Merged
Merged
Conversation
Saved semester plans store hidden tutorial slots as "<course id>:appointment:<appointment id>". The incremental import kept course ids but reallocated parallel-group and appointment ids, so a re-import of a period silently un-hid every tutorial slot students had chosen for it. - Reuse parallel-group ids keyed by (period, unit_id, group position) and appointment ids keyed by (period, unit_id, group position, position). - Print which courses were added, removed, or changed (title, times, rooms, dates) against the target D1, with per-appointment details. - --skip-if-unchanged stops before writing anything when nothing changed, for scheduled refreshes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Deploying studyplaner with
|
| Latest commit: |
cab1eb3
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://e300278d.studyplaner.pages.dev |
| Branch Preview URL: | https://fix-incremental-import-stabl.studyplaner.pages.dev |
The before/after check now counts saved semester-plan references (courseIds and hidden tutorial slots by appointment id) that point at no catalog row, and fails when an import increases either count. Production currently has 7 such slot references from the unrecorded WS 26/27 re-import. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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
Saved semester plans store hidden tutorial slots as
<course id>:appointment:<appointment id>. The incremental import (#35) kept course ids stable but re-allocated parallel-group and appointment ids, so re-importing a period silently un-hid every tutorial slot students had chosen for it. This already happened once for WS 26/27: two users' 7 hidden-slot references now point at deleted appointment ids.--skip-if-unchangedstops before writing anything when nothing changed — for the scheduled WS 26/27 refreshes.Verification
backend/tests/test_import_alma_json_to_d1.py: 17 tests (new: re-import keeps group/appointment ids; change summary reports added/removed/changed), run against the real migration schema.Follow-up (not in this PR)
Repairing the 7 dangling hidden-slot references of the two affected users is a one-off data fix, done separately with approval.
🤖 Generated with Claude Code