Skip to content

Commit

Permalink
SAK-49766 Assignments releasing submissions should work consistently #…
Browse files Browse the repository at this point in the history
…12390

https://sakaiproject.atlassian.net/browse/SAK-49766
- this also removes the outdated option withGrade
  • Loading branch information
ern committed Feb 29, 2024
1 parent f3ac543 commit 58ca0e5
Show file tree
Hide file tree
Showing 26 changed files with 807 additions and 871 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,6 @@ public enum IMSGradingProgress {

public static final String STATE_CONTEXT_STRING = "Assignment.context_string";

public static final String WITH_GRADES = "with_grades";

public static final String GRADE_SUBMISSION_SUBMISSION_ID = "grade_submission_submission_id";
public static final String GRADE_SUBMISSION_ASSIGNMENT_ID = "grade_submission_assignment_id";
public static final String GRADE_SUBMISSION_GRADE = "grade_submission_grade";
Expand Down
3 changes: 2 additions & 1 deletion assignment/api/src/resources/assignment.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,8 @@ sendFeedback.label = Send Feedback to Multiple Students
sendFeedback.instruction = Select students from the table below. Write your feedback in the following text area, select any additional feedback options, and then click "Update" to save.
sendFeedback.options = Feedback options
sendFeedback.overwrite = Replace existing "Instructor Summary Comments" feedback for selected students.
sendFeedback.returnToStudents = Return feedback to selected students now. (NOTE: Only the feedback will be released, if you want to release the grades you must click on "Release Grades").
sendFeedback.returnToStudents = Return feedback to selected students now
sendFeedback.returnToStudents.note = (NOTE: Only the feedback will be released, if you want to release the grades you must click on "Release Grades")
sendFeedback.nouser = Please choose at least one student to send feedback.
sendFeedback.nocomment = Please enter a feedback comment.
sendFeedback.savedow = Feedback has been replaced and saved successfully.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1942,21 +1942,31 @@ private AssignmentConstants.SubmissionStatus getGradersCanonicalSubmissionStatus
}
} else {
if (returnTime != null && returnTime.isAfter(submitTime)) {
return resubmissionAllowed ? SubmissionStatus.RETURNED_PENDING_RESUBMIT : SubmissionStatus.RETURNED;
return resubmissionAllowed ? SubmissionStatus.RETURNED_PENDING_RESUBMIT : SubmissionStatus.RETURNED;
} else {
return SubmissionStatus.RETURNED;
}
}
} else if (submission.getGraded()) {
return StringUtils.isNotBlank(submission.getGrade()) ? SubmissionStatus.GRADED : SubmissionStatus.COMMENTED;
} else {
return SubmissionStatus.UNGRADED;
if (StringUtils.isNotBlank(submission.getGrade())) {
return SubmissionStatus.GRADED;
} else if (StringUtils.isNotBlank(submission.getFeedbackComment())) {
return SubmissionStatus.COMMENTED;
}
} else if (StringUtils.isNotBlank(submission.getFeedbackComment())) {
return SubmissionStatus.COMMENTED;
}
} else {
if (submission.getReturned()) {
return SubmissionStatus.RETURNED;
} else if (submission.getGraded()) {
return StringUtils.isNotBlank(submission.getGrade()) ? SubmissionStatus.GRADED : SubmissionStatus.COMMENTED;
if (StringUtils.isNotBlank(submission.getGrade())) {
return SubmissionStatus.GRADED;
} else if (StringUtils.isNotBlank(submission.getFeedbackComment())) {
return SubmissionStatus.COMMENTED;
}
} else if (StringUtils.isNotBlank(submission.getFeedbackComment())) {
return SubmissionStatus.COMMENTED;
} else {
return SubmissionStatus.NO_SUBMISSION;
}
Expand All @@ -1968,12 +1978,17 @@ private AssignmentConstants.SubmissionStatus getGradersCanonicalSubmissionStatus
return SubmissionStatus.RETURNED;
} else {
// grade saved but not release yet, show this to graders
return StringUtils.isNotBlank(submission.getGrade()) ? AssignmentConstants.SubmissionStatus.GRADED : AssignmentConstants.SubmissionStatus.COMMENTED;
if (StringUtils.isNotBlank(submission.getGrade())) {
return SubmissionStatus.GRADED;
} else if (StringUtils.isNotBlank(submission.getFeedbackComment())) {
return SubmissionStatus.COMMENTED;
}
}
} else {
return SubmissionStatus.UNGRADED;
} else if (StringUtils.isNotBlank(submission.getFeedbackComment())) {
return SubmissionStatus.COMMENTED;
}
}
return SubmissionStatus.UNGRADED;
}

private AssignmentConstants.SubmissionStatus getSubmittersCanonicalSubmissionStatus(AssignmentSubmission submission) {
Expand Down Expand Up @@ -2936,8 +2951,6 @@ public boolean isGradeOverridden(AssignmentSubmission submission, String submitt
* Contains logic to consistently output a String based version of a grade
* Interprets the grade using the scale for display
*
* This should probably be moved to a static utility class - ern
*
* @param grade
* @param typeOfGrade
* @param scaleFactor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -833,15 +833,17 @@ public void submissionCanonicalStatus() {
assignment.setDueDate(null);
Assert.assertEquals(AssignmentConstants.SubmissionStatus.GRADED, assignmentService.getSubmissionCanonicalStatus(submission, true));

// submission is Submitted | DateSubmitted exists | submission not Returned | submission is Graded | User can Grade | Grade not exists = COMMENTED
// submission is Submitted | DateSubmitted exists | submission not Returned | submission is Graded | User can Grade | Comment exists | Grade not exists = COMMENTED
submission.setSubmitted(true);
submission.setDateSubmitted(now);
submission.setReturned(false);
submission.setDateReturned(null);
submission.setGraded(true);
submission.setGrade(null);
submission.setFeedbackComment("Graders comment");
assignment.setDueDate(null);
Assert.assertEquals(AssignmentConstants.SubmissionStatus.COMMENTED, assignmentService.getSubmissionCanonicalStatus(submission, true));
submission.setFeedbackComment(null);

// submission is Submitted | DateSubmitted exists | submission not Returned | User can't Grade = SUBMITTED
submission.setSubmitted(true);
Expand Down Expand Up @@ -884,15 +886,17 @@ public void submissionCanonicalStatus() {
assignment.setDueDate(null);
Assert.assertEquals(AssignmentConstants.SubmissionStatus.GRADED, assignmentService.getSubmissionCanonicalStatus(submission, true));

// submission is Submitted | DateSubmitted not exists | submission not Returned | submission is Graded | User can Grade | Grade not exists = COMMENTED
// submission is Submitted | DateSubmitted not exists | submission not Returned | submission is Graded | User can Grade | Comment exists | Grade not exists = COMMENTED
submission.setSubmitted(true);
submission.setDateSubmitted(null);
submission.setReturned(false);
submission.setDateReturned(null);
submission.setGraded(true);
submission.setGrade(null);
submission.setFeedbackComment("Graders comment");
assignment.setDueDate(null);
Assert.assertEquals(AssignmentConstants.SubmissionStatus.COMMENTED, assignmentService.getSubmissionCanonicalStatus(submission, true));
submission.setFeedbackComment(null);

// submission is Submitted | DateSubmitted not exists | submission not Returned | submission not Graded | User can't Grade | Assignment is HonorPledge | Submission is HonorPledge = HONOR_ACCEPTED
submission.setSubmitted(true);
Expand Down Expand Up @@ -991,12 +995,14 @@ public void submissionCanonicalStatus() {
submission.setGrade("1000");
Assert.assertEquals(AssignmentConstants.SubmissionStatus.GRADED, assignmentService.getSubmissionCanonicalStatus(submission, true));

// submission not Submitted | submission Graded | submission not Returned | User can Grade | Grade not exists = COMMENTED
// submission not Submitted | submission Graded | submission not Returned | User can Grade | Comment exists | Grade not exists = COMMENTED
submission.setSubmitted(false);
submission.setReturned(false);
submission.setGraded(true);
submission.setFeedbackComment("Graders comment");
submission.setGrade(null);
Assert.assertEquals(AssignmentConstants.SubmissionStatus.COMMENTED, assignmentService.getSubmissionCanonicalStatus(submission, true));
submission.setFeedbackComment(null);

// submission not Submitted | submission Graded | submission not Returned | User can't Grade = IN_PROGRESS
submission.setSubmitted(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1161,10 +1161,16 @@ public ActionReturn setGrade(Map<String, Object> params) {
throw new EntityException("You don't have permission to set grades", "", HttpServletResponse.SC_FORBIDDEN);
}

if (assignment.getTypeOfGrade() == Assignment.GradeType.SCORE_GRADE_TYPE) {
grade = assignmentToolUtils.scalePointGrade(grade, assignment.getScaleFactor(), alerts);
} else if (assignment.getTypeOfGrade() == Assignment.GradeType.PASS_FAIL_GRADE_TYPE && grade.equals(AssignmentConstants.UNGRADED_GRADE_STRING)) {
grade = null;
switch (assignment.getTypeOfGrade()) {
case SCORE_GRADE_TYPE:
grade = assignmentToolUtils.scalePointGrade(grade, assignment.getScaleFactor(), alerts);
break;
case UNGRADED_GRADE_TYPE:
grade = ASSN_GRADE_TYPE_NOGRADE_PROP;
break;
case PASS_FAIL_GRADE_TYPE:
if (AssignmentConstants.UNGRADED_GRADE_STRING.equals(grade)) grade = null;
default:
}

Map<String, Object> options = new HashMap<>();
Expand All @@ -1187,7 +1193,6 @@ public ActionReturn setGrade(Map<String, Object> params) {
options.put(GRADE_SUBMISSION_FEEDBACK_TEXT, feedbackText);
options.put(GRADE_SUBMISSION_FEEDBACK_COMMENT, feedbackComment);
options.put(GRADE_SUBMISSION_PRIVATE_NOTES, privateNotes);
options.put(WITH_GRADES, true);
options.put(ALLOW_RESUBMIT_NUMBER, resubmitNumber);

if (StringUtils.isNotBlank(resubmitDate)) {
Expand Down
Loading

0 comments on commit 58ca0e5

Please sign in to comment.