Clear season and episode number when an episode changes series (#11) #26

Merged
eric merged 1 commit from eric/fix-11-series-change-season into master 2026-10-12 15:50:46 -05:00 AGit
Owner

Closes #11

Problem: assigning an episode to another series only changed series_id. The episode kept the season and episode number from its old series until the cleanup at the next startup. Until then, Repeat Action and auto-numbering could act on the wrong data.

Fix (src/database.rs):

  • create_series_and_assign clears season_id and episode_number, since a brand-new series has no seasons.
  • assign_series clears them only when the series actually changes. Picking the series the episode is already in keeps its season and number. I added that so re-selecting the same series by accident doesn't lose anything.

Testing:

  • New tests/database_tests.rs uses a real temporary SQLite database. It covers re-assigning the same series (kept), creating a new series (cleared) and moving to another existing series (cleared). It fails on master and passes with the fix.
  • Full suite: 207 passed, 3 failed. The failures are the timing tests fixed in #25, which this branch doesn't include.

🤖 Generated with Claude Code

https://claude.ai/code/session_01E2XefpQijvBcJBfgzuaoWA

Closes #11 **Problem:** assigning an episode to another series only changed `series_id`. The episode kept the season and episode number from its old series until the cleanup at the next startup. Until then, Repeat Action and auto-numbering could act on the wrong data. **Fix** (`src/database.rs`): - `create_series_and_assign` clears `season_id` and `episode_number`, since a brand-new series has no seasons. - `assign_series` clears them only when the series actually changes. Picking the series the episode is already in keeps its season and number. I added that so re-selecting the same series by accident doesn't lose anything. **Testing:** - New `tests/database_tests.rs` uses a real temporary SQLite database. It covers re-assigning the same series (kept), creating a new series (cleared) and moving to another existing series (cleared). It fails on master and passes with the fix. - Full suite: 207 passed, 3 failed. The failures are the timing tests fixed in #25, which this branch doesn't include. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01E2XefpQijvBcJBfgzuaoWA
assign_series and create_series_and_assign only updated series_id, so
the episode kept the season and episode number from its old series
until startup cleanup fixed it on the next launch. Repeat Action and
auto-numbering could act on that stale data in the meantime.

Moving an episode to a different series now clears season_id and
episode_number. Re-assigning the series it's already in keeps them.

Closes #11

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E2XefpQijvBcJBfgzuaoWA
eric merged commit 75dabc73d7 into master 2026-10-12 15:50:46 -05:00
Sign in to join this conversation.
No reviewers
No labels
bug
chore
feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
spinach-dev/movies!26
No description provided.