fix(requests): stop editing a request from re-requesting covered seasons - #3379
fix(requests): stop editing a request from re-requesting covered seasons#3379fallenbagel wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughTV request updates now distinguish retained request seasons from seasons already available on media. Covered seasons are excluded, new seasons are appended, and quota calculations use the resulting season set. Tests cover responses, retention, server updates, and quota behavior. ChangesTV season availability
Estimated code review effort: 3 (Moderate) | ~20 minutes Mergeability Score: ⚪ Minimal · up to This change prevents covered seasons from being re-requested during edits and adjusts quota calculation to the seasons retained by the request; no actionable merge-blocking risk remains beyond normal checks and review. Sequence Diagram(s)sequenceDiagram
participant RequestRoute
participant TVMedia
participant TVQuota
RequestRoute->>TVMedia: Read available media seasons
TVMedia-->>RequestRoute: Return covered seasons
RequestRoute->>RequestRoute: Retain owned seasons and append uncovered seasons
RequestRoute->>TVQuota: Calculate quota from resulting seasons
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
247423f to
2391580
Compare
There was a problem hiding this comment.
Pull request overview
This PR adjusts the TV request update (PUT /request/:requestId) logic to prevent adding seasons that are already covered by existing season availability, and updates the test suite to validate the new behavior.
Changes:
- Exclude “covered” seasons (based on
Media.seasonsstatus) from being newly added to an existing TV request during updates. - Update quota calculations to use the post-filter season count for the request update path.
- Add targeted tests for season-availability behavior during request updates.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| server/routes/request.ts | Filters out covered seasons when updating TV requests; recalculates required seasons accordingly. |
| server/routes/request.test.ts | Adds helpers and new tests covering season-availability behavior in PUT updates. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This comment was marked as outdated.
This comment was marked as outdated.
2391580 to
97e5636
Compare
This comment was marked as outdated.
This comment was marked as outdated.
Creating a request skips seasons the media already has, but editing one only looked at seasons held by other requests, so an edit could add a season that was already available and charge the owner's quota for it. The availability check applies to seasons being added, not to the ones the request already holds, otherwise editing an approved request would drop its own seasons the moment they started processing. The quota arithmetic now counts the seasons the edit actually ends up with rather than assuming that is every season it asked for.
97e5636 to
b73a73c
Compare
Description
Creating a request skips seasons the media already has, but editing one only looked at seasons other requests hold. An edit could therefore add a season that was already available and charge the owner's quota for it.
The availability check applies only to seasons being added, not to the ones the request already holds. This matters because a request's own seasons stop being unknown as soon as it is approved, so treating them the same way would drop them from the request the moment they started processing.
This sits on the quota check PR below it and updates its arithmetic, which until now could assume the edit ends up with every season it asked for. That is no longer true once covered seasons are dropped, so the quota is charged against the seasons the edit actually ends up with.
How Has This Been Tested?
Screenshots / Logs (if applicable)
Checklist:
pnpm buildpnpm i18n:extractSummary by CodeRabbit