You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds APIs to update the problems of a Blueprint assignment. Stacked on #3974 (feat/blueprint-assignment-problem-create).
Changes are also applied to linked section copies (Assignment) in the same transaction.
Update API
updateBlueprintAssignmentProblems(blueprintAssignmentId, problems: [{ problemId, score }]): updates problem scores
updateBlueprintAssignmentProblemsOrder(blueprintAssignmentId, orders: [problemId]): resets order from 0 by array index
Permission: professors and TAs of the blueprint course (via assertBlueprintLeader)
Errors:
Score: CONFLICT if a linked copy has learning records, NOT_FOUND if a problem is not in the blueprint assignment
Order: UNPROCESSABLE_DATA if orders does not list every problem exactly once
Both: NOT_FOUND if the blueprint assignment does not exist, FORBIDDEN if not a leader
Changes
Add updateBlueprintAssignmentProblems and updateBlueprintAssignmentProblemsOrder to the service and resolver
Lock the source first with lockBlueprintAssignment, same as #3967
Block score changes when copies have learning records (reuses assertAssignmentsHaveNoLearningRecords); allow order changes since they do not affect grading
Additional context
Based on the existing updateAssignmentProblems / updateAssignmentProblemsOrder structure
11 service unit tests added
schema.gql, D will be updated in a following commit
Before submitting the PR, please make sure you do the following
Auto reviews are disabled on base/target branches other than the default branch.
Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: 63325de9-68f8-4a81-a148-568d7d059192
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
The change adds mutations to update blueprint assignment problem scores and ordering. The service validates each request and applies updates to the blueprint assignment and its linked copies. Tests cover authorization, validation, and copy updates.
Changes: Blueprint assignment problem updates
Layer / File(s)
Summary
Update problem scores apps/backend/apps/admin/src/blueprint-assignment-problem/blueprint-assignment-problem.resolver.ts, apps/backend/apps/admin/src/blueprint-assignment-problem/blueprint-assignment-problem.service.ts, apps/backend/apps/admin/src/blueprint-assignment-problem/blueprint-assignment-problem.service.spec.ts
The resolver exposes a score-update mutation. The service checks access, imported problems, and copy learning records before updating the blueprint and its copies. Tests cover authorization, score propagation, and rejected updates.
Update problem order apps/backend/apps/admin/src/blueprint-assignment-problem/blueprint-assignment-problem.resolver.ts, apps/backend/apps/admin/src/blueprint-assignment-problem/blueprint-assignment-problem.service.ts, apps/backend/apps/admin/src/blueprint-assignment-problem/blueprint-assignment-problem.service.spec.ts
The resolver parses an integer order array. The service requires every imported problem ID exactly once, then updates ordering on the blueprint and its copies. Tests cover authorization, validation, and reordering despite submissions.
skkuding/codedang#3886: Adds the Prisma models and relations that this PR reads and updates.
Merge Risk: Minimal · previous review 800ae
This PR adds mutations to update problem scores and ordering on Blueprint assignments and apply the changes to linked section copies. Authorization, locking, and input validation checks are in place, and no concrete defects were found. The only CI failure is a formatting warning in a file this PR does not change, so merge risk is minimal.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "feat(be): add update blueprint assignment problems" matches the main change. The PR adds two mutations to the admin resolver, updateBlueprintAssignmentProblems (score updates) and updateBlu…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "feat(be): add update blueprint assignment problems" matches the main change. The PR adds two mutations to the admin resolver, updateBlueprintAssignmentProblems (score updates) and updateBlueprintAssignmentProblemsOrder (ordering), with service logic that propagates changes to assignment copies. The title names the core feature (updating blueprint assignment problems) and omits the ordering mutation and the copy propagation, which is acceptable for a title. It is concise, specific, and follows a conventional commit format.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Fix failing CI checks
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
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
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.
Description
Adds APIs to update the problems of a Blueprint assignment. Stacked on #3974 (
feat/blueprint-assignment-problem-create).Changes are also applied to linked section copies (
Assignment) in the same transaction.Update API
updateBlueprintAssignmentProblems(blueprintAssignmentId, problems: [{ problemId, score }]): updates problem scoresupdateBlueprintAssignmentProblemsOrder(blueprintAssignmentId, orders: [problemId]): resetsorderfrom 0 by array indexassertBlueprintLeader)CONFLICTif a linked copy has learning records,NOT_FOUNDif a problem is not in the blueprint assignmentUNPROCESSABLE_DATAifordersdoes not list every problem exactly onceNOT_FOUNDif the blueprint assignment does not exist,FORBIDDENif not a leaderChanges
updateBlueprintAssignmentProblemsandupdateBlueprintAssignmentProblemsOrderto the service and resolverlockBlueprintAssignment, same as #3967assertAssignmentsHaveNoLearningRecords); allow order changes since they do not affect gradingAdditional context
updateAssignmentProblems/updateAssignmentProblemsOrderstructureschema.gql, D will be updated in a following commitBefore submitting the PR, please make sure you do the following
fixes #123).Summary by CodeRabbit