SAK-52547 Assignments preserve Gradebook category on import - #14607
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds a new public constant ChangesAssignment Category Remapping During Transfer/Import
Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ast-grep (0.42.2)assignment/impl/src/java/org/sakaiproject/assignment/impl/AssignmentServiceImpl.javaThanks 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@assignment/impl/src/java/org/sakaiproject/assignment/impl/AssignmentServiceImpl.java`:
- Around line 4707-4711: The category remapping
(remapImportedAssignmentCategoryProperty) runs too early using
assignmentAddToGradebookChoice; remove that early call and instead perform the
remap (or removal of NEW_ASSIGNMENT_CATEGORY from nProperties) after the code
that finalizes NEW_ASSIGNMENT_ADD_TO_GRADEBOOK (the switch/logic that can change
ADD→ASSOCIATE/NO). Concretely: delete the current invocation that uses
fromContext/toContext at the top, and add a conditional after the final
gradebook-mode decision that calls
remapImportedAssignmentCategoryProperty(nProperties, fromContext, toContext)
only when NEW_ASSIGNMENT_ADD_TO_GRADEBOOK == GRADEBOOK_INTEGRATION_ADD,
otherwise ensure nProperties.remove(NEW_ASSIGNMENT_CATEGORY) is executed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1d41ea41-0c90-4dfd-934b-b3f39dc302ba
📒 Files selected for processing (3)
assignment/api/src/java/org/sakaiproject/assignment/api/AssignmentConstants.javaassignment/impl/src/java/org/sakaiproject/assignment/impl/AssignmentServiceImpl.javaassignment/impl/src/test/org/sakaiproject/assignment/impl/AssignmentTransferCopyEntitiesTest.java
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@assignment/impl/src/java/org/sakaiproject/assignment/impl/AssignmentServiceImpl.java`:
- Around line 5689-5694: The code calls
gradingService.getCategoryDefinitions(fromGradebookId, fromGradebookId).stream()
which can return null and throw NPE; in AssignmentServiceImpl locate the
sourceCategory creation (variable sourceCategory) and first retrieve the list
into a local variable (e.g., categoryDefs) or wrap the call with
Optional.ofNullable, guard against null before streaming/filtering, and if null
treat it as empty collection so the subsequent Optional logic returns
Optional.empty() rather than throwing.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1c428aa5-bb0b-4abd-83e7-8f243c6b27b5
📒 Files selected for processing (2)
assignment/impl/src/java/org/sakaiproject/assignment/impl/AssignmentServiceImpl.javaassignment/impl/src/test/org/sakaiproject/assignment/impl/AssignmentTransferCopyEntitiesTest.java
(cherry picked from commit d5a2583)
Summary by CodeRabbit
Bug Fixes
Tests