-
-
Notifications
You must be signed in to change notification settings - Fork 1k
SAK-52306 Assignments add resubmission limits to SimpleAssignment #14343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1846,6 +1846,17 @@ public class SimpleAssignment { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private boolean allowResubmission; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Number of allowed re-submissions, using the current | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * function in AssignmentAction assignment_resubmission_option_into_context() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String resubmissionNumber = "0"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Honor Pledge is set or not | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private boolean honorPledge; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Supplement items: model answer text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1977,6 +1988,8 @@ public SimpleAssignment(Assignment a, boolean hydrate) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Translate grade scale from its numeric value to its description. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.gradeScale = a.getTypeOfGrade().toString(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.honorPledge = a.getHonorPledge(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // If grade scale is "points" we also capture the maximum points allowed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (a.getTypeOfGrade() == Assignment.GradeType.SCORE_GRADE_TYPE) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Integer scaleFactor = a.getScaleFactor() != null ? a.getScaleFactor() : assignmentService.getScaleFactor(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1985,6 +1998,15 @@ public SimpleAssignment(Assignment a, boolean hydrate) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Use the number of submissions allowed as an indicator that re-submission is permitted. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (a.getProperties().get(ALLOW_RESUBMIT_NUMBER) != null && a.getTypeOfSubmission() != Assignment.SubmissionType.NON_ELECTRONIC_ASSIGNMENT_SUBMISSION) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Integer allowResubmitNumber = Integer.parseInt( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| a.getProperties().get(ALLOW_RESUBMIT_NUMBER) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.resubmissionNumber = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| allowResubmitNumber == -1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? rb.getString("allow.resubmit.number.unlimited") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : allowResubmitNumber.toString(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.allowResubmission = true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
2000
to
2010
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (a.getProperties().get(ALLOW_RESUBMIT_NUMBER) != null && a.getTypeOfSubmission() != Assignment.SubmissionType.NON_ELECTRONIC_ASSIGNMENT_SUBMISSION) { | |
| Integer allowResubmitNumber = Integer.parseInt( | |
| a.getProperties().get(ALLOW_RESUBMIT_NUMBER) | |
| ); | |
| this.resubmissionNumber = | |
| allowResubmitNumber == -1 | |
| ? rb.getString("allow.resubmit.number.unlimited") | |
| : allowResubmitNumber.toString(); | |
| this.allowResubmission = true; | |
| String allowResubmitStr = a.getProperties().get(ALLOW_RESUBMIT_NUMBER); | |
| if (StringUtils.isNotBlank(allowResubmitStr) | |
| && a.getTypeOfSubmission() != Assignment.SubmissionType.NON_ELECTRONIC_ASSIGNMENT_SUBMISSION) { | |
| try { | |
| Integer allowResubmitNumber = Integer.parseInt(allowResubmitStr); | |
| this.resubmissionNumber = | |
| allowResubmitNumber == -1 | |
| ? rb.getString("allow.resubmit.number.unlimited") | |
| : allowResubmitNumber.toString(); | |
| this.allowResubmission = true; | |
| } catch (NumberFormatException nfe) { | |
| log.warn("Invalid value for {} on assignment {}: '{}'", ALLOW_RESUBMIT_NUMBER, a.getId(), allowResubmitStr); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resubmissionNumberis modeled as aStringand is later set to a localized label for the unlimited case. This makes the entity response locale-dependent and hard to consume programmatically (clients can’t reliably parse/compare the value). Prefer returning a numeric value (e.g.,int/Integerwith-1for unlimited) and/or a separate boolean likeresubmissionUnlimited, and let the UI localize the label.