diff --git a/assignment/api/src/java/org/sakaiproject/assignment/api/AssignmentConstants.java b/assignment/api/src/java/org/sakaiproject/assignment/api/AssignmentConstants.java index c290403dbb95..014c27513b45 100644 --- a/assignment/api/src/java/org/sakaiproject/assignment/api/AssignmentConstants.java +++ b/assignment/api/src/java/org/sakaiproject/assignment/api/AssignmentConstants.java @@ -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"; diff --git a/assignment/impl/src/java/org/sakaiproject/assignment/impl/AssignmentServiceImpl.java b/assignment/impl/src/java/org/sakaiproject/assignment/impl/AssignmentServiceImpl.java index cbbc4c547c2f..6841823cb6ee 100644 --- a/assignment/impl/src/java/org/sakaiproject/assignment/impl/AssignmentServiceImpl.java +++ b/assignment/impl/src/java/org/sakaiproject/assignment/impl/AssignmentServiceImpl.java @@ -2936,8 +2936,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 diff --git a/assignment/tool/src/java/org/sakaiproject/assignment/entityproviders/AssignmentEntityProvider.java b/assignment/tool/src/java/org/sakaiproject/assignment/entityproviders/AssignmentEntityProvider.java index ee2fa382ef0c..b81a45894826 100644 --- a/assignment/tool/src/java/org/sakaiproject/assignment/entityproviders/AssignmentEntityProvider.java +++ b/assignment/tool/src/java/org/sakaiproject/assignment/entityproviders/AssignmentEntityProvider.java @@ -1187,7 +1187,6 @@ public ActionReturn setGrade(Map 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)) { diff --git a/assignment/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java b/assignment/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java index cbaab70dcbe3..e0584897043b 100644 --- a/assignment/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java +++ b/assignment/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java @@ -47,13 +47,6 @@ import static org.sakaiproject.assignment.api.AssignmentServiceConstants.PROP_ASSIGNMENT_GROUP_FILTER_ENABLED; import static org.sakaiproject.assignment.api.AssignmentServiceConstants.REFERENCE_ROOT; import static org.sakaiproject.assignment.api.AssignmentServiceConstants.SECURE_UPDATE_ASSIGNMENT; -import static org.sakaiproject.assignment.api.model.Assignment.GradeType.CHECK_GRADE_TYPE; -import static org.sakaiproject.assignment.api.model.Assignment.GradeType.GRADE_TYPE_NONE; -import static org.sakaiproject.assignment.api.model.Assignment.GradeType.LETTER_GRADE_TYPE; -import static org.sakaiproject.assignment.api.model.Assignment.GradeType.PASS_FAIL_GRADE_TYPE; -import static org.sakaiproject.assignment.api.model.Assignment.GradeType.SCORE_GRADE_TYPE; -import static org.sakaiproject.assignment.api.model.Assignment.GradeType.UNGRADED_GRADE_TYPE; -import static org.sakaiproject.assignment.api.model.Assignment.GradeType.values; import org.sakaiproject.util.CalendarUtil; @@ -956,10 +949,6 @@ public class AssignmentAction extends PagedResourceActionII { * The selected view */ private static final String STATE_SELECTED_VIEW = "state_selected_view"; - /** - * The configuration choice of with grading option or not - */ - private static final String WITH_GRADES = "with_grades"; /** * The configuration choice of showing or hiding the number of submissions column */ @@ -1378,9 +1367,6 @@ public String buildMainPanelContext(VelocityPortlet portlet, Context context, Ru context.put("peerAssessmentUse", rb.getFormattedMessage("peerAssessmentUse")); } - // grading option - context.put("withGrade", state.getAttribute(WITH_GRADES)); - // the grade type table context.put("gradeTypeTable", gradeTypeTable()); @@ -3276,7 +3262,7 @@ protected void setAssignmentFormContext(SessionState state, Context context) { anonGrading = (Boolean) state.getAttribute(NEW_ASSIGNMENT_CHECK_ANONYMOUS_GRADING); } - Assignment.GradeType gradeType = values()[(Integer) state.getAttribute(NEW_ASSIGNMENT_GRADE_TYPE)]; + Assignment.GradeType gradeType = Assignment.GradeType.values()[(Integer) state.getAttribute(NEW_ASSIGNMENT_GRADE_TYPE)]; String maxGrade = (String) state.getAttribute(NEW_ASSIGNMENT_GRADE_POINTS); context.put("value_GradeType", gradeType.ordinal()); context.put("value_GradePoints", assignmentService.getGradeDisplay(maxGrade, gradeType, scaleFactor)); @@ -3846,7 +3832,7 @@ private String build_instructor_preview_assignment_context(VelocityPortlet portl context.put("gradeName", getGradeName(a, assignmentId)); context.put("value_CheckAnonymousGrading", assignmentService.assignmentUsesAnonymousGrading(a)); context.put("isDraft", a.getDraft()); - if (a.getTypeOfGrade() == SCORE_GRADE_TYPE) { + if (a.getTypeOfGrade() == Assignment.GradeType.SCORE_GRADE_TYPE) { String maxGrade = (String) state.getAttribute(NEW_ASSIGNMENT_GRADE_POINTS); context.put("value_GradePoints", displayGrade(state, maxGrade, a.getScaleFactor())); } @@ -3904,7 +3890,7 @@ protected String build_instructor_delete_assignment_context(VelocityPortlet port * build the instructor view to grade an submission */ protected String build_instructor_grade_submission_context(VelocityPortlet portlet, Context context, RunData data, SessionState state) { - Assignment.GradeType gradeType = GRADE_TYPE_NONE; + Assignment.GradeType gradeType = Assignment.GradeType.GRADE_TYPE_NONE; Integer scaleFactor = assignmentService.getScaleFactor(); // need to show the alert for grading drafts? @@ -3952,7 +3938,7 @@ protected String build_instructor_grade_submission_context(VelocityPortlet portl a.getAttachments().forEach(r -> attachmentReferences.put(r, entityManager.newReference(r))); context.put("assignmentAttachmentReferences", attachmentReferences); - if (a.getTypeOfGrade() == SCORE_GRADE_TYPE) { + if (a.getTypeOfGrade() == Assignment.GradeType.SCORE_GRADE_TYPE) { context.put("value_grade", displayGrade(state, (String) state.getAttribute(GRADE_SUBMISSION_GRADE), scaleFactor)); } } @@ -4774,7 +4760,7 @@ private String build_instructor_preview_grade_submission_context(VelocityPortlet // format to show "factor" decimal places String grade = (String) state.getAttribute(GRADE_SUBMISSION_GRADE); - if (assignment.getTypeOfGrade() == SCORE_GRADE_TYPE) { + if (assignment.getTypeOfGrade() == Assignment.GradeType.SCORE_GRADE_TYPE) { grade = displayGrade(state, grade, assignment.getScaleFactor()); } context.put("grade", grade); @@ -4839,7 +4825,7 @@ private String build_instructor_grade_assignment_context(VelocityPortlet portlet Assignment.GradeType gradeType = assignment.getTypeOfGrade(); context.put("typeOfGrade", gradeType.ordinal()); context.put("typeOfGradeString", getTypeOfGradeString(gradeType)); - if (gradeType.equals(SCORE_GRADE_TYPE)) { + if (gradeType.equals(Assignment.GradeType.SCORE_GRADE_TYPE)) { Integer scaleFactor = assignment.getScaleFactor() != null ? assignment.getScaleFactor() : assignmentService.getScaleFactor(); context.put("maxGradePointString", assignmentService.getMaxPointGradeDisplay(scaleFactor, assignment.getMaxGradePoint())); } @@ -5178,7 +5164,7 @@ private String build_instructor_view_assignment_context(VelocityPortlet portlet, putCreatorIntoContext(context, assignment); context.put("typeOfGradeString", getTypeOfGradeString(assignment.getTypeOfGrade())); - if (assignment.getTypeOfGrade().equals(SCORE_GRADE_TYPE)) { + if (assignment.getTypeOfGrade().equals(Assignment.GradeType.SCORE_GRADE_TYPE)) { Integer scaleFactor = assignment.getScaleFactor() != null ? assignment.getScaleFactor() : assignmentService.getScaleFactor(); context.put("maxGradePointString", assignmentService.getMaxPointGradeDisplay(scaleFactor, assignment.getMaxGradePoint())); } @@ -5307,7 +5293,7 @@ private String build_instructor_reorder_assignment_context(VelocityPortlet portl } // build_instructor_reorder_assignment_context private String build_student_review_edit_context(VelocityPortlet portlet, Context context, RunData data, SessionState state) { - Assignment.GradeType gradeType = GRADE_TYPE_NONE; + Assignment.GradeType gradeType = Assignment.GradeType.GRADE_TYPE_NONE; context.put("context", state.getAttribute(STATE_CONTEXT_STRING)); List peerAssessmentItems = (List) state.getAttribute(PEER_ASSESSMENT_ITEMS); String assignmentId = (String) state.getAttribute(VIEW_ASSIGNMENT_ID); @@ -6987,7 +6973,7 @@ private void post_save_submission(RunData data, boolean post) { if (StringUtils.isBlank(previousGrades)) { previousGrades = properties.get(ResourceProperties.PROP_SUBMISSION_PREVIOUS_GRADES); if (StringUtils.isNotBlank(previousGrades)) { - if (a.getTypeOfGrade() == SCORE_GRADE_TYPE) { + if (a.getTypeOfGrade() == Assignment.GradeType.SCORE_GRADE_TYPE) { // point grade assignment type // some old unscaled grades, need to scale the number and remove the old property String[] grades = StringUtils.split(previousGrades, " "); @@ -7583,21 +7569,17 @@ private void setNewAssignmentParameters(RunData data, boolean validify) { // ------------------- BEGIN GRADING PARAMS ------------------- - Assignment.GradeType gradeType = GRADE_TYPE_NONE; - // grade type and grade points - if (state.getAttribute(WITH_GRADES) != null && (Boolean) state.getAttribute(WITH_GRADES)) { - boolean gradeAssignment = params.getBoolean(NEW_ASSIGNMENT_GRADE_ASSIGNMENT); - state.setAttribute(NEW_ASSIGNMENT_GRADE_ASSIGNMENT, gradeAssignment); - int gType = gradeAssignment ? params.getInt(NEW_ASSIGNMENT_GRADE_TYPE) : UNGRADED_GRADE_TYPE.ordinal(); - gradeType = values()[gType]; - state.setAttribute(NEW_ASSIGNMENT_GRADE_TYPE, gradeType.ordinal()); - } + boolean gradeAssignment = params.getBoolean(NEW_ASSIGNMENT_GRADE_ASSIGNMENT); + state.setAttribute(NEW_ASSIGNMENT_GRADE_ASSIGNMENT, gradeAssignment); + int gType = gradeAssignment ? params.getInt(NEW_ASSIGNMENT_GRADE_TYPE) : Assignment.GradeType.UNGRADED_GRADE_TYPE.ordinal(); + Assignment.GradeType gradeType = Assignment.GradeType.values()[gType]; + state.setAttribute(NEW_ASSIGNMENT_GRADE_TYPE, gradeType.ordinal()); // check if grade type is switching and prompt for confirmation if graded submissions exist if (StringUtils.isNotBlank(assignmentRef)) { Assignment asn = getAssignment(assignmentRef, "setNewAssignmentParameters", state); - if (asn != null && gradeType != GRADE_TYPE_NONE && asn.getTypeOfGrade() != gradeType) { + if (asn != null && gradeType != Assignment.GradeType.GRADE_TYPE_NONE && asn.getTypeOfGrade() != gradeType) { state.setAttribute(NEW_ASSIGNMENT_GRADE_TYPE_SWITCHING, Boolean.TRUE); Set submissions = assignmentService.getSubmissions(asn); if (submissions.stream().anyMatch(s -> s.getGraded())) { @@ -7635,7 +7617,7 @@ private void setNewAssignmentParameters(RunData data, boolean validify) { String associateAssignment = params.getString(PROP_ASSIGNMENT_ASSOCIATE_GRADEBOOK_ASSIGNMENT); Double droppedCategoryPoints = -1D; - if (grading != null && gradeType != UNGRADED_GRADE_TYPE) { + if (grading != null && gradeType != Assignment.GradeType.UNGRADED_GRADE_TYPE) { if (grading.equals(GRADEBOOK_INTEGRATION_ASSOCIATE)) { state.setAttribute(PROP_ASSIGNMENT_ASSOCIATE_GRADEBOOK_ASSIGNMENT, associateAssignment); } else { @@ -7644,7 +7626,7 @@ private void setNewAssignmentParameters(RunData data, boolean validify) { if (!grading.equals(GRADEBOOK_INTEGRATION_NO)) { // gradebook integration only available to point-grade assignment - if (gradeType != SCORE_GRADE_TYPE) { + if (gradeType != Assignment.GradeType.SCORE_GRADE_TYPE) { addAlert(state, rb.getString("addtogradebook.wrongGradeScale")); } @@ -7724,7 +7706,7 @@ private void setNewAssignmentParameters(RunData data, boolean validify) { //Peer Assessment boolean peerAssessment = false; - if (gradeType == SCORE_GRADE_TYPE && params.getBoolean(NEW_ASSIGNMENT_USE_PEER_ASSESSMENT)) { + if (gradeType == Assignment.GradeType.SCORE_GRADE_TYPE && params.getBoolean(NEW_ASSIGNMENT_USE_PEER_ASSESSMENT)) { state.setAttribute(NEW_ASSIGNMENT_USE_PEER_ASSESSMENT, Boolean.TRUE.toString()); peerAssessment = true; } else { @@ -8028,11 +8010,11 @@ private void setNewAssignmentParameters(RunData data, boolean validify) { String option = params.get("option"); - if (!"attach".equals(option) && state.getAttribute(WITH_GRADES) != null && (Boolean) state.getAttribute(WITH_GRADES)) { + if (!"attach".equals(option)) { // the grade point String gradePoints = params.getString(NEW_ASSIGNMENT_GRADE_POINTS); state.setAttribute(NEW_ASSIGNMENT_GRADE_POINTS, gradePoints); - if (gradePoints != null && gradeType == SCORE_GRADE_TYPE) { + if (gradePoints != null && gradeType == Assignment.GradeType.SCORE_GRADE_TYPE) { if (gradePoints.length() == 0) { // in case of point grade assignment, user must specify maximum grade point addAlert(state, rb.getString("plespethe3")); @@ -8604,7 +8586,7 @@ private void post_save_assignment(RunData data, String postOrSave) { Assignment.SubmissionType submissionType = Assignment.SubmissionType.values()[(Integer) state.getAttribute(NEW_ASSIGNMENT_SUBMISSION_TYPE)]; - Assignment.GradeType gradeType = values()[(Integer) state.getAttribute(NEW_ASSIGNMENT_GRADE_TYPE)]; + Assignment.GradeType gradeType = Assignment.GradeType.values()[(Integer) state.getAttribute(NEW_ASSIGNMENT_GRADE_TYPE)]; String gradePoints = (String) state.getAttribute(NEW_ASSIGNMENT_GRADE_POINTS); @@ -9225,7 +9207,7 @@ private void initIntegrateWithGradebook(SessionState state, String siteId, Strin addUpdateRemoveAssignment = "update"; } - if (!"remove".equals(addUpdateRemoveAssignment) && gradeType == SCORE_GRADE_TYPE) { + if (!"remove".equals(addUpdateRemoveAssignment) && gradeType == Assignment.GradeType.SCORE_GRADE_TYPE) { try { addAlerts(state, assignmentToolUtils.integrateGradebook(stateToMap(state), assignmentReference, associateGradebookAssignment, addUpdateRemoveAssignment, aOldTitle, title, Integer.parseInt(gradePoints), dueTime, null, null, category)); @@ -9725,7 +9707,7 @@ private void commitAssignment(SessionState state, // post the assignment if appropriate a.setDraft(!post); - if (gradeType == SCORE_GRADE_TYPE) { + if (gradeType == Assignment.GradeType.SCORE_GRADE_TYPE) { if (a.getScaleFactor() == null) { // only set the default scale factor if the assignment does not have one a.setScaleFactor(assignmentService.getScaleFactor()); @@ -10219,7 +10201,7 @@ public void doEdit_assignment(RunData data) { state.setAttribute(NEW_ASSIGNMENT_SUBMISSION_TYPE, a.getTypeOfSubmission().ordinal()); state.setAttribute(NEW_ASSIGNMENT_CATEGORY, 0); state.setAttribute(NEW_ASSIGNMENT_GRADE_TYPE, a.getTypeOfGrade().ordinal()); - if (a.getTypeOfGrade() == SCORE_GRADE_TYPE) { + if (a.getTypeOfGrade() == Assignment.GradeType.SCORE_GRADE_TYPE) { state.setAttribute(NEW_ASSIGNMENT_GRADE_POINTS, a.getMaxGradePoint().toString()); } state.setAttribute(NEW_ASSIGNMENT_DESCRIPTION, a.getInstructions()); @@ -10875,18 +10857,12 @@ public void doRelease_grades(RunData data) { for (AssignmentSubmission s : submissions) { String grade = s.getGrade(); if (s.getGraded() || StringUtils.isNotBlank(grade)) { - boolean withGrade = state.getAttribute(WITH_GRADES) != null ? (Boolean) state.getAttribute(WITH_GRADES) : false; - if (withGrade) { - // for the assignment tool with grade option, a valide grade is needed - if (StringUtils.isNotBlank(grade)) { - s.setGradeReleased(true); - if (!s.getGraded()) { - s.setGraded(true); - } - } - } else { - // for the assignment tool without grade option, no grade is needed + // for the assignment tool with grade option, a valide grade is needed + if (StringUtils.isNotBlank(grade)) { s.setGradeReleased(true); + if (!s.getGraded()) { + s.setGraded(true); + } } // also set the return status @@ -11740,7 +11716,6 @@ public boolean readGradeForm(RunData data, SessionState state, String gradeOptio // security check for allowing grading submission or not if (assignmentService.allowGradeSubmission(sId)) { - boolean withGrade = state.getAttribute(WITH_GRADES) != null ? (Boolean) state.getAttribute(WITH_GRADES) : false; String feedbackComment = processFormattedTextFromBrowser(state, params.getCleanString(GRADE_SUBMISSION_FEEDBACK_COMMENT), true); // comment value changed? @@ -11782,120 +11757,117 @@ public boolean readGradeForm(RunData data, SessionState state, String gradeOptio int factor = a.getScaleFactor() != null ? a.getScaleFactor() : assignmentService.getScaleFactor(); Assignment.GradeType typeOfGrade = a.getTypeOfGrade(); - if (withGrade) { - // any change in grade. Do not check for ungraded assignment type - if (!hasChange && typeOfGrade != UNGRADED_GRADE_TYPE) { - if (typeOfGrade == SCORE_GRADE_TYPE) { - String currentGrade = submission.getGrade(); + // any change in grade. Do not check for ungraded assignment type + if (!hasChange && typeOfGrade != Assignment.GradeType.UNGRADED_GRADE_TYPE) { + if (typeOfGrade == Assignment.GradeType.SCORE_GRADE_TYPE) { + String currentGrade = submission.getGrade(); - String decSeparator = formattedText.getDecimalSeparator(); + String decSeparator = formattedText.getDecimalSeparator(); - if (currentGrade != null && currentGrade.contains(decSeparator)) { - currentGrade = scalePointGrade(state, submission.getGrade(), factor); - } - hasChange = valueDiffFromStateAttribute(state, scalePointGrade(state, g, factor), currentGrade); - } else { - hasChange = valueDiffFromStateAttribute(state, g, submission.getGrade()); + if (currentGrade != null && currentGrade.contains(decSeparator)) { + currentGrade = scalePointGrade(state, submission.getGrade(), factor); } - } - if (g != null) { - state.setAttribute(GRADE_SUBMISSION_GRADE, g); + hasChange = valueDiffFromStateAttribute(state, scalePointGrade(state, g, factor), currentGrade); } else { - state.removeAttribute(GRADE_SUBMISSION_GRADE); + hasChange = valueDiffFromStateAttribute(state, g, submission.getGrade()); } + } + if (g != null) { + state.setAttribute(GRADE_SUBMISSION_GRADE, g); + } else { + state.removeAttribute(GRADE_SUBMISSION_GRADE); + } - // for points grading, one have to enter number as the points - String grade = (String) state.getAttribute(GRADE_SUBMISSION_GRADE); - - // do grade validation only for Assignment with Grade tool - if (typeOfGrade == SCORE_GRADE_TYPE) { - if ((grade != null)) { - // the preview grade process might already scaled up the grade by "factor" - if (!((String) state.getAttribute(STATE_MODE)).equals(MODE_INSTRUCTOR_PREVIEW_GRADE_SUBMISSION)) { - if (state.getAttribute(STATE_MESSAGE) == null) { - validPointGrade(state, grade, factor); - int maxGrade = a.getMaxGradePoint(); - try { - if (state.getAttribute(STATE_MESSAGE) == null && Integer.parseInt(scalePointGrade(state, grade, factor)) > maxGrade) { - if (state.getAttribute(GRADE_GREATER_THAN_MAX_ALERT) == null) { - // alert user first when he enters grade bigger than max scale - addAlert(state, rb.getFormattedMessage("grad2", grade, displayGrade(state, String.valueOf(maxGrade), factor))); - state.setAttribute(GRADE_GREATER_THAN_MAX_ALERT, Boolean.TRUE); - } else { - // remove the alert once user confirms he wants to give student higher grade - state.removeAttribute(GRADE_GREATER_THAN_MAX_ALERT); - } + // for points grading, one have to enter number as the points + String grade = (String) state.getAttribute(GRADE_SUBMISSION_GRADE); + + // do grade validation only for Assignment with Grade tool + if (typeOfGrade == Assignment.GradeType.SCORE_GRADE_TYPE) { + if ((grade != null)) { + // the preview grade process might already scaled up the grade by "factor" + if (!((String) state.getAttribute(STATE_MODE)).equals(MODE_INSTRUCTOR_PREVIEW_GRADE_SUBMISSION)) { + if (state.getAttribute(STATE_MESSAGE) == null) { + validPointGrade(state, grade, factor); + int maxGrade = a.getMaxGradePoint(); + try { + if (state.getAttribute(STATE_MESSAGE) == null && Integer.parseInt(scalePointGrade(state, grade, factor)) > maxGrade) { + if (state.getAttribute(GRADE_GREATER_THAN_MAX_ALERT) == null) { + // alert user first when he enters grade bigger than max scale + addAlert(state, rb.getFormattedMessage("grad2", grade, displayGrade(state, String.valueOf(maxGrade), factor))); + state.setAttribute(GRADE_GREATER_THAN_MAX_ALERT, Boolean.TRUE); + } else { + // remove the alert once user confirms he wants to give student higher grade + state.removeAttribute(GRADE_GREATER_THAN_MAX_ALERT); } - } catch (NumberFormatException e) { - alertInvalidPoint(state, grade, factor); - log.warn(this + ":readGradeForm " + e.getMessage()); } + } catch (NumberFormatException e) { + alertInvalidPoint(state, grade, factor); + log.warn(this + ":readGradeForm " + e.getMessage()); } - - state.setAttribute(GRADE_SUBMISSION_GRADE, grade); } + + state.setAttribute(GRADE_SUBMISSION_GRADE, grade); } } + } - // if ungraded and grade type is not "ungraded" type - if ((grade == null || UNGRADED_GRADE_STRING.equals(grade)) && (typeOfGrade != UNGRADED_GRADE_TYPE) && "release".equals(gradeOption)) { - addAlert(state, rb.getString("plespethe2")); - } + // if ungraded and grade type is not "ungraded" type + if ((grade == null || UNGRADED_GRADE_STRING.equals(grade)) && (typeOfGrade != Assignment.GradeType.UNGRADED_GRADE_TYPE) && "release".equals(gradeOption)) { + addAlert(state, rb.getString("plespethe2")); + } - // check for grade overrides - if (a.getIsGroup()) { - HashMap scaledValues = new HashMap(); - Set submitters = submission.getSubmitters(); - for (AssignmentSubmissionSubmitter submitter : submitters) { - String ug = StringUtils.trimToNull(params.getCleanString(GRADE_SUBMISSION_GRADE + "_" + submitter.getSubmitter())); - if ("null".equals(ug)) ug = null; - if (!hasChange && typeOfGrade != UNGRADED_GRADE_TYPE) { - hasChange = valueDiffFromStateAttribute(state, ug, submitter.getGrade()); - } - if (ug == null) { - state.removeAttribute(GRADE_SUBMISSION_GRADE + "_" + submitter.getSubmitter()); - } else { - state.setAttribute(GRADE_SUBMISSION_GRADE + "_" + submitter.getSubmitter(), ug); - } - // for points grading, one have to enter number as the points - String ugrade = (String) state.getAttribute(GRADE_SUBMISSION_GRADE + "_" + submitter.getSubmitter()); - // do grade validation only for Assignment with Grade tool - if (typeOfGrade == SCORE_GRADE_TYPE) { - if (ugrade != null && !(ugrade.equals("null"))) { - // the preview grade process might already scaled up the grade by "factor" - if (!((String) state.getAttribute(STATE_MODE)).equals(MODE_INSTRUCTOR_PREVIEW_GRADE_SUBMISSION)) { - validPointGrade(state, ugrade, factor); - if (state.getAttribute(STATE_MESSAGE) == null) { - int maxGrade = a.getMaxGradePoint(); - try { - if (Integer.parseInt(scalePointGrade(state, ugrade, factor)) > maxGrade) { - if (state.getAttribute(GRADE_GREATER_THAN_MAX_ALERT) == null) { - // alert user first when he enters grade bigger than max scale - addAlert(state, rb.getFormattedMessage("grad2", ugrade, displayGrade(state, String.valueOf(maxGrade), factor))); - state.setAttribute(GRADE_GREATER_THAN_MAX_ALERT, Boolean.TRUE); - } else { - // remove the alert once user confirms he wants to give student higher grade - state.removeAttribute(GRADE_GREATER_THAN_MAX_ALERT); - } + // check for grade overrides + if (a.getIsGroup()) { + HashMap scaledValues = new HashMap(); + Set submitters = submission.getSubmitters(); + for (AssignmentSubmissionSubmitter submitter : submitters) { + String ug = StringUtils.trimToNull(params.getCleanString(GRADE_SUBMISSION_GRADE + "_" + submitter.getSubmitter())); + if ("null".equals(ug)) ug = null; + if (!hasChange && typeOfGrade != Assignment.GradeType.UNGRADED_GRADE_TYPE) { + hasChange = valueDiffFromStateAttribute(state, ug, submitter.getGrade()); + } + if (ug == null) { + state.removeAttribute(GRADE_SUBMISSION_GRADE + "_" + submitter.getSubmitter()); + } else { + state.setAttribute(GRADE_SUBMISSION_GRADE + "_" + submitter.getSubmitter(), ug); + } + // for points grading, one have to enter number as the points + String ugrade = (String) state.getAttribute(GRADE_SUBMISSION_GRADE + "_" + submitter.getSubmitter()); + // do grade validation only for Assignment with Grade tool + if (typeOfGrade == Assignment.GradeType.SCORE_GRADE_TYPE) { + if (ugrade != null && !(ugrade.equals("null"))) { + // the preview grade process might already scaled up the grade by "factor" + if (!((String) state.getAttribute(STATE_MODE)).equals(MODE_INSTRUCTOR_PREVIEW_GRADE_SUBMISSION)) { + validPointGrade(state, ugrade, factor); + if (state.getAttribute(STATE_MESSAGE) == null) { + int maxGrade = a.getMaxGradePoint(); + try { + if (Integer.parseInt(scalePointGrade(state, ugrade, factor)) > maxGrade) { + if (state.getAttribute(GRADE_GREATER_THAN_MAX_ALERT) == null) { + // alert user first when he enters grade bigger than max scale + addAlert(state, rb.getFormattedMessage("grad2", ugrade, displayGrade(state, String.valueOf(maxGrade), factor))); + state.setAttribute(GRADE_GREATER_THAN_MAX_ALERT, Boolean.TRUE); + } else { + // remove the alert once user confirms he wants to give student higher grade + state.removeAttribute(GRADE_GREATER_THAN_MAX_ALERT); } - } catch (NumberFormatException e) { - alertInvalidPoint(state, ugrade, factor); - log.warn(this + ":readGradeForm User " + e.getMessage()); } + } catch (NumberFormatException e) { + alertInvalidPoint(state, ugrade, factor); + log.warn(this + ":readGradeForm User " + e.getMessage()); } - scaledValues.put(GRADE_SUBMISSION_GRADE + "_" + submitter.getSubmitter(), scalePointGrade(state, ugrade, factor)); } + scaledValues.put(GRADE_SUBMISSION_GRADE + "_" + submitter.getSubmitter(), scalePointGrade(state, ugrade, factor)); } } } - // SAK-28182 If all grades are right place scaled values in state - if (state.getAttribute(STATE_MESSAGE) == null) { - for (Map.Entry entry : scaledValues.entrySet()) { - state.setAttribute(entry.getKey(), entry.getValue()); - } + } + // SAK-28182 If all grades are right place scaled values in state + if (state.getAttribute(STATE_MESSAGE) == null) { + for (Map.Entry entry : scaledValues.entrySet()) { + state.setAttribute(entry.getKey(), entry.getValue()); } } - } // allow resubmit number and due time @@ -11922,8 +11894,7 @@ public boolean readGradeForm(RunData data, SessionState state, String gradeOptio hasChange = hasChange || change_resubmit_option(state, submission.getProperties()); hasChange = hasChange || propertyValueChanged(state, submission.getProperties(), AssignmentConstants.ALLOW_EXTENSION_CLOSETIME); //same for Extension. if (state.getAttribute(STATE_MESSAGE) == null) { - String grade = (String) state.getAttribute(GRADE_SUBMISSION_GRADE); - grade = (typeOfGrade == SCORE_GRADE_TYPE) ? scalePointGrade(state, grade, factor) : grade; + grade = (typeOfGrade == Assignment.GradeType.SCORE_GRADE_TYPE) ? scalePointGrade(state, grade, factor) : grade; state.setAttribute(GRADE_SUBMISSION_GRADE, grade); } } @@ -12229,15 +12200,6 @@ protected void initState(SessionState state, VelocityPortlet portlet, JetspeedRu state.setAttribute(STATE_TOP_PAGE_MESSAGE, 0); } - if (state.getAttribute(WITH_GRADES) == null) { - PortletConfig config = portlet.getPortletConfig(); - String withGrades = StringUtils.trimToNull(config.getInitParameter("withGrades")); - if (withGrades == null) { - withGrades = Boolean.FALSE.toString(); - } - state.setAttribute(WITH_GRADES, Boolean.valueOf(withGrades)); - } - // whether to display the number of submission/ungraded submission column // default to show if (state.getAttribute(SHOW_NUMBER_SUBMISSION_COLUMN) == null) { @@ -12418,8 +12380,7 @@ private void initializeAssignment(SessionState state) { state.setAttribute(NEW_ASSIGNMENT_SUBMISSION_TYPE, Assignment.SubmissionType.TEXT_AND_ATTACHMENT_ASSIGNMENT_SUBMISSION.ordinal()); Boolean withGradesConfig = serverConfigurationService.getBoolean("assignment.grade.default", Boolean.TRUE); if (withGradesConfig) { - state.setAttribute(WITH_GRADES, Boolean.TRUE); - state.setAttribute(NEW_ASSIGNMENT_GRADE_TYPE, SCORE_GRADE_TYPE.ordinal()); + state.setAttribute(NEW_ASSIGNMENT_GRADE_TYPE, Assignment.GradeType.SCORE_GRADE_TYPE.ordinal()); String defaultPointsConfig = serverConfigurationService.getString("assignment.points.default", ""); if (NumberUtils.isParsable(defaultPointsConfig)) { float defaultPoints = NumberUtils.createFloat(defaultPointsConfig); @@ -12428,7 +12389,7 @@ private void initializeAssignment(SessionState state) { state.setAttribute(NEW_ASSIGNMENT_GRADE_POINTS, ""); } } else { - state.setAttribute(NEW_ASSIGNMENT_GRADE_TYPE, UNGRADED_GRADE_TYPE.ordinal()); + state.setAttribute(NEW_ASSIGNMENT_GRADE_TYPE, Assignment.GradeType.UNGRADED_GRADE_TYPE.ordinal()); state.setAttribute(NEW_ASSIGNMENT_GRADE_POINTS, ""); } state.setAttribute(NEW_ASSIGNMENT_CONTENT_ID, null); @@ -13555,7 +13516,7 @@ public void doSet_defaultNotGradedNonElectronicScore(RunData data) { String assignmentId = (String) state.getAttribute(EXPORT_ASSIGNMENT_REF); Assignment a = getAssignment(assignmentId, "doSet_defaultNotGradedNonElectronicScore", state); if (a != null) { - if (a.getTypeOfGrade() == SCORE_GRADE_TYPE) { + if (a.getTypeOfGrade() == Assignment.GradeType.SCORE_GRADE_TYPE) { //for point-based grades if (a.getScaleFactor() == null) a.setScaleFactor(assignmentService.getScaleFactor()); validPointGrade(state, grade, a.getScaleFactor()); @@ -13594,7 +13555,7 @@ public void doSet_defaultNotGradedNonElectronicScore(RunData data) { if (grade != null && state.getAttribute(STATE_MESSAGE) == null) { - if (a.getTypeOfGrade() == SCORE_GRADE_TYPE) { + if (a.getTypeOfGrade() == Assignment.GradeType.SCORE_GRADE_TYPE) { grade = scalePointGrade(state, grade, a.getScaleFactor()); } @@ -13641,7 +13602,7 @@ public void doSet_defaultNoSubmissionScore(RunData data) { String assignmentId = (String) state.getAttribute(EXPORT_ASSIGNMENT_REF); Assignment a = getAssignment(assignmentId, "doSet_defaultNoSubmissionScore", state); if (a != null) { - if (a.getTypeOfGrade() == SCORE_GRADE_TYPE) { + if (a.getTypeOfGrade() == Assignment.GradeType.SCORE_GRADE_TYPE) { //for point-based grades if (a.getScaleFactor() == null) a.setScaleFactor(assignmentService.getScaleFactor()); validPointGrade(state, grade, a.getScaleFactor()); @@ -13679,7 +13640,7 @@ public void doSet_defaultNoSubmissionScore(RunData data) { if (grade != null && state.getAttribute(STATE_MESSAGE) == null) { - if (a.getTypeOfGrade() == SCORE_GRADE_TYPE) { + if (a.getTypeOfGrade() == Assignment.GradeType.SCORE_GRADE_TYPE) { grade = scalePointGrade(state, grade, a.getScaleFactor()); } @@ -13952,16 +13913,16 @@ private Map uploadAll_parseZipFile(SessionState stat if (w != null) { String itemString = assignment.getIsGroup() ? items[3] : items[4]; Assignment.GradeType gradeType = assignment.getTypeOfGrade(); - if (gradeType == SCORE_GRADE_TYPE) { + if (gradeType == Assignment.GradeType.SCORE_GRADE_TYPE) { validPointGrade(state, itemString, assignment.getScaleFactor()); } // SAK-24199 - Applied patch provided with a few additional modifications. - else if (gradeType == PASS_FAIL_GRADE_TYPE) { + else if (gradeType == Assignment.GradeType.PASS_FAIL_GRADE_TYPE) { itemString = validatePassFailGradeValue(state, itemString); } else { validLetterGrade(state, itemString); } if (state.getAttribute(STATE_MESSAGE) == null) { - w.setGrade(gradeType == SCORE_GRADE_TYPE ? scalePointGrade(state, itemString, assignment.getScaleFactor()) : itemString); + w.setGrade(gradeType == Assignment.GradeType.SCORE_GRADE_TYPE ? scalePointGrade(state, itemString, assignment.getScaleFactor()) : itemString); submissionTable.put(eid, w); } } @@ -14008,7 +13969,7 @@ else if (gradeType == PASS_FAIL_GRADE_TYPE) { if (w != null) { itemString = assignment.getIsGroup() ? hssfRow.getCell(3).toString() : hssfRow.getCell(4).toString(); Assignment.GradeType gradeType = assignment.getTypeOfGrade(); - if (gradeType == SCORE_GRADE_TYPE) { + if (gradeType == Assignment.GradeType.SCORE_GRADE_TYPE) { //Parse the string to double using the locale format try { itemString = assignment.getIsGroup() ? hssfRow.getCell(3).getStringCellValue() : hssfRow.getCell(4).getStringCellValue(); @@ -14032,13 +13993,13 @@ else if (gradeType == PASS_FAIL_GRADE_TYPE) { } validPointGrade(state, itemString, assignment.getScaleFactor()); - } else if (gradeType == PASS_FAIL_GRADE_TYPE) { + } else if (gradeType == Assignment.GradeType.PASS_FAIL_GRADE_TYPE) { itemString = validatePassFailGradeValue(state, itemString); } else { validLetterGrade(state, itemString); } if (state.getAttribute(STATE_MESSAGE) == null) { - w.setGrade(gradeType == SCORE_GRADE_TYPE ? scalePointGrade(state, itemString, assignment.getScaleFactor()) : itemString); + w.setGrade(gradeType == Assignment.GradeType.SCORE_GRADE_TYPE ? scalePointGrade(state, itemString, assignment.getScaleFactor()) : itemString); submissionTable.put(eid, w); } } @@ -15359,7 +15320,7 @@ private String getAssignmentStatus(String assignmentId, SessionState state) { */ protected void setScoringAgentProperties(Context context, Assignment assignment, AssignmentSubmission submission, boolean gradeView) { String associatedGbItem = assignment.getProperties().get(PROP_ASSIGNMENT_ASSOCIATE_GRADEBOOK_ASSIGNMENT); - if (!assignment.getIsGroup() && submission != null && StringUtils.isNotBlank(associatedGbItem) && assignment.getTypeOfGrade() == SCORE_GRADE_TYPE) { + if (!assignment.getIsGroup() && submission != null && StringUtils.isNotBlank(associatedGbItem) && assignment.getTypeOfGrade() == Assignment.GradeType.SCORE_GRADE_TYPE) { ScoringService scoringService = (ScoringService) ComponentManager.get("org.sakaiproject.scoringservice.api.ScoringService"); ScoringAgent scoringAgent = scoringService.getDefaultScoringAgent(); @@ -15965,8 +15926,8 @@ else if (m_criteria.equals(SORTED_GRADE_SUBMISSION_CONTENTREVIEW)) { } // if scale is points - if ((s1.getAssignment().getTypeOfGrade() == SCORE_GRADE_TYPE) - && ((s2.getAssignment().getTypeOfGrade() == SCORE_GRADE_TYPE))) { + if ((s1.getAssignment().getTypeOfGrade() == Assignment.GradeType.SCORE_GRADE_TYPE) + && ((s2.getAssignment().getTypeOfGrade() == Assignment.GradeType.SCORE_GRADE_TYPE))) { if ("".equals(grade1)) { result = -1; } else if ("".equals(grade2)) { @@ -16070,8 +16031,8 @@ else if (m_criteria.equals(SORTED_SUBMISSION_BY_LASTNAME)) { } // if scale is points - if ((((AssignmentSubmission) o1).getAssignment().getTypeOfGrade() == SCORE_GRADE_TYPE) - && ((((AssignmentSubmission) o2).getAssignment().getTypeOfGrade() == SCORE_GRADE_TYPE))) { + if ((((AssignmentSubmission) o1).getAssignment().getTypeOfGrade() == Assignment.GradeType.SCORE_GRADE_TYPE) + && ((((AssignmentSubmission) o2).getAssignment().getTypeOfGrade() == Assignment.GradeType.SCORE_GRADE_TYPE))) { if ("".equals(grade1)) { result = -1; } else if ("".equals(grade2)) { @@ -16094,8 +16055,8 @@ else if (m_criteria.equals(SORTED_SUBMISSION_BY_LASTNAME)) { } // if scale is points - if ((((AssignmentSubmission) o1).getAssignment().getTypeOfGrade() == SCORE_GRADE_TYPE) - && ((((AssignmentSubmission) o2).getAssignment().getTypeOfGrade() == SCORE_GRADE_TYPE))) { + if ((((AssignmentSubmission) o1).getAssignment().getTypeOfGrade() == Assignment.GradeType.SCORE_GRADE_TYPE) + && ((((AssignmentSubmission) o2).getAssignment().getTypeOfGrade() == Assignment.GradeType.SCORE_GRADE_TYPE))) { if ("".equals(grade1)) { result = -1; } else if ("".equals(grade2)) { @@ -16276,22 +16237,22 @@ private int compareInstant(Instant t1, Instant t2) { private String maxGrade(Assignment.GradeType gradeType, Assignment a) { String maxGrade = ""; - if (gradeType == GRADE_TYPE_NONE) { + if (gradeType == Assignment.GradeType.GRADE_TYPE_NONE) { // Grade type not set maxGrade = rb.getString("granotset"); - } else if (gradeType == UNGRADED_GRADE_TYPE) { + } else if (gradeType == Assignment.GradeType.UNGRADED_GRADE_TYPE) { // Ungraded grade type maxGrade = rb.getString("gen.nograd"); - } else if (gradeType == LETTER_GRADE_TYPE) { + } else if (gradeType == Assignment.GradeType.LETTER_GRADE_TYPE) { // Letter grade type maxGrade = "A"; - } else if (gradeType == SCORE_GRADE_TYPE) { + } else if (gradeType == Assignment.GradeType.SCORE_GRADE_TYPE) { // Score based grade type maxGrade = Integer.toString(a.getMaxGradePoint()); - } else if (gradeType == PASS_FAIL_GRADE_TYPE) { + } else if (gradeType == Assignment.GradeType.PASS_FAIL_GRADE_TYPE) { // Pass/fail grade type maxGrade = rb.getString("pass"); - } else if (gradeType == CHECK_GRADE_TYPE) { + } else if (gradeType == Assignment.GradeType.CHECK_GRADE_TYPE) { // Grade type that only requires a check maxGrade = rb.getString("check"); } diff --git a/assignment/tool/src/java/org/sakaiproject/assignment/tool/AssignmentToolUtils.java b/assignment/tool/src/java/org/sakaiproject/assignment/tool/AssignmentToolUtils.java index b20864511391..860d305b735b 100644 --- a/assignment/tool/src/java/org/sakaiproject/assignment/tool/AssignmentToolUtils.java +++ b/assignment/tool/src/java/org/sakaiproject/assignment/tool/AssignmentToolUtils.java @@ -38,6 +38,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import org.sakaiproject.assignment.api.AssignmentReferenceReckoner; import org.sakaiproject.assignment.api.AssignmentService; @@ -275,63 +276,81 @@ public List alertInvalidPoint(String grade, int factor) { public void gradeSubmission(AssignmentSubmission submission, String gradeOption, Map options, List alerts) { if (submission != null) { - boolean withGrade = options.get(WITH_GRADES) != null && (Boolean) options.get(WITH_GRADES); - String grade = (String) options.get(GRADE_SUBMISSION_GRADE); - boolean gradeChanged = false; - if (!StringUtils.equals(StringUtils.trimToNull(submission.getGrade()), StringUtils.trimToNull(grade))) { - //one is null the other isn't - gradeChanged = true; - } Assignment a = submission.getAssignment(); - if (!withGrade) { - // no grade input needed for the without-grade version of assignment tool + String grade = assignmentService.getGradeDisplay((String) options.get(GRADE_SUBMISSION_GRADE), a.getTypeOfGrade(), a.getScaleFactor()); + + boolean gradeChanged = !StringUtils.equals(StringUtils.trimToNull(submission.getGrade()), StringUtils.trimToNull(grade)); + + // the instructor feedback comment + String submittedfeedbackComment = StringUtils.trimToNull((String) options.get(GRADE_SUBMISSION_FEEDBACK_COMMENT)); + if (submittedfeedbackComment != null) { + submission.setFeedbackComment(submittedfeedbackComment); + } else { + submission.setFeedbackComment(null); + } + + // the instructor inline feedback + String submittedfeedbackText = StringUtils.trimToNull((String) options.get(GRADE_SUBMISSION_FEEDBACK_TEXT)); + if (submittedfeedbackText != null) { + submission.setFeedbackText(submittedfeedbackText); + } else { + submission.setFeedbackText(null); + } + + List submittedfeedbackAttachments = (List) options.get(GRADE_SUBMISSION_FEEDBACK_ATTACHMENT); + if (submittedfeedbackAttachments != null) { + // clear the old attachments first + Set feedbackAttachments = submission.getFeedbackAttachments(); + if (!BooleanUtils.toBoolean((Boolean) options.get(GRADE_SUBMISSION_DONT_CLEAR_CURRENT_ATTACHMENTS))) { + feedbackAttachments.clear(); + } + for (Reference attachment : submittedfeedbackAttachments) { + feedbackAttachments.add(attachment.getReference()); + } + } + + String submittedInstructorPrivateNotes = StringUtils.trimToNull((String) options.get(GRADE_SUBMISSION_PRIVATE_NOTES)); + if (submittedInstructorPrivateNotes != null) { + submission.setPrivateNotes(submittedInstructorPrivateNotes); + } + + // determine if the submission is graded + if (StringUtils.isNotBlank(grade)) { + // if there is a grade then the submission is graded submission.setGraded(true); + submission.setGrade(grade); + if (gradeChanged) { submission.setGradedBy(userDirectoryService.getCurrentUser() == null ? null : userDirectoryService.getCurrentUser().getId()); } - if (SUBMISSION_OPTION_RETURN.equals(gradeOption) || SUBMISSION_OPTION_RELEASE.equals(gradeOption)) { - submission.setGradeReleased(true); - } + } else if (submittedfeedbackComment != null) { + // if there is feedback by the instructor regardless of an entered grade + submission.setGraded(true); } else { - //If the grade is not blank - if (StringUtils.isNotBlank(grade)) { - submission.setGrade(grade); - submission.setGraded(true); - if (gradeChanged) { - submission.setGradedBy(userDirectoryService.getCurrentUser() == null ? null : userDirectoryService.getCurrentUser().getId()); - } - } else { - submission.setGrade(null); - submission.setGraded(false); - if (gradeChanged) { - submission.setGradedBy(null); - } + // if no grade or feedback left then it is not graded + submission.setGrade(null); + submission.setGraded(false); + if (gradeChanged) { + submission.setGradedBy(null); } } - // iterate through submitters and look for grade overrides... - if (withGrade && a.getIsGroup()) { + if (a.getIsGroup()) { + // group project only set a grade override for submitters for (AssignmentSubmissionSubmitter submitter : submission.getSubmitters()) { - String g = (String) options.get(GRADE_SUBMISSION_GRADE + "_" + submitter.getSubmitter()); - if (g != submitter.getGrade()) submitter.setGrade(g); + String submitterGradeOverride = StringUtils.trimToNull((String) options.get(GRADE_SUBMISSION_GRADE + "_" + submitter.getSubmitter())); + if (!StringUtils.equals(submitterGradeOverride, submitter.getGrade())) { + submitter.setGrade(submitterGradeOverride); + } } } if (SUBMISSION_OPTION_RELEASE.equals(gradeOption)) { submission.setGradeReleased(true); - submission.setGraded(true); - if (gradeChanged) { - submission.setGradedBy(userDirectoryService.getCurrentUser() == null ? null : userDirectoryService.getCurrentUser().getId()); - } - // clear the returned flag submission.setReturned(false); submission.setDateReturned(null); } else if (SUBMISSION_OPTION_RETURN.equals(gradeOption)) { submission.setGradeReleased(true); - submission.setGraded(true); - if (gradeChanged) { - submission.setGradedBy(userDirectoryService.getCurrentUser() == null ? null : userDirectoryService.getCurrentUser().getId()); - } submission.setReturned(true); submission.setDateReturned(Instant.now()); } else if (SUBMISSION_OPTION_RETRACT.equals(gradeOption)) { @@ -369,41 +388,6 @@ public void gradeSubmission(AssignmentSubmission submission, String gradeOption, properties.remove(ALLOW_EXTENSION_CLOSETIME); } - // the instructor comment - String feedbackCommentString = StringUtils.trimToNull((String) options.get(GRADE_SUBMISSION_FEEDBACK_COMMENT)); - if (feedbackCommentString != null) { - submission.setFeedbackComment(feedbackCommentString); - } else { - submission.setFeedbackComment(""); - } - - // the instructor inline feedback - String feedbackTextString = (String) options.get(GRADE_SUBMISSION_FEEDBACK_TEXT); - if (feedbackTextString != null) { - submission.setFeedbackText(feedbackTextString); - } - - List v = (List) options.get(GRADE_SUBMISSION_FEEDBACK_ATTACHMENT); - if (v != null) { - - // clear the old attachments first - Set feedbackAttachments = submission.getFeedbackAttachments(); - - boolean clear = !(options.get(GRADE_SUBMISSION_DONT_CLEAR_CURRENT_ATTACHMENTS) != null - && (Boolean) options.get(GRADE_SUBMISSION_DONT_CLEAR_CURRENT_ATTACHMENTS)); - if (clear) { - feedbackAttachments.clear(); - } - - for (Reference aV : v) { - feedbackAttachments.add(aV.getReference()); - } - } - - if (options.get(GRADE_SUBMISSION_PRIVATE_NOTES) != null) { - submission.setPrivateNotes((String) options.get(GRADE_SUBMISSION_PRIVATE_NOTES)); - } - String sReference = AssignmentReferenceReckoner.reckoner().submission(submission).reckon().getReference(); // save a timestamp for this grading process diff --git a/assignment/tool/src/webapp/WEB-INF/tools/sakai.assignment.grades.xml b/assignment/tool/src/webapp/WEB-INF/tools/sakai.assignment.grades.xml index baf820a107ac..168a7097f945 100644 --- a/assignment/tool/src/webapp/WEB-INF/tools/sakai.assignment.grades.xml +++ b/assignment/tool/src/webapp/WEB-INF/tools/sakai.assignment.grades.xml @@ -12,7 +12,6 @@ - diff --git a/assignment/tool/src/webapp/vm/assignment/assignment_macros.vm b/assignment/tool/src/webapp/vm/assignment/assignment_macros.vm index eb276b9d5786..092b1efac840 100644 --- a/assignment/tool/src/webapp/vm/assignment/assignment_macros.vm +++ b/assignment/tool/src/webapp/vm/assignment/assignment_macros.vm @@ -92,7 +92,7 @@ #end ## Macro for the top nav bar HREF and #toolLink/#toolLinkParam -#macro( navBarHREF $allowAddAssignment $withGrade $allowGradeSubmission $allowAddAssignment $allowRecoverAssignment $allowAllGroups $assignmentscheck $allowUpdateSite $enableViewOption $view $current ) +#macro( navBarHREF $allowAddAssignment $allowGradeSubmission $allowAddAssignment $allowRecoverAssignment $allowAllGroups $assignmentscheck $allowUpdateSite $enableViewOption $view $current )