Skip to content

Commit

Permalink
SAK-50072 Assignments have grader use correct return url from student…
Browse files Browse the repository at this point in the history
…s list (#12578)
  • Loading branch information
bgarciaentornos authored May 8, 2024
1 parent bbbbfcd commit 8dbbfc9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4343,7 +4343,22 @@ protected String build_instructor_grade_submission_context(VelocityPortlet portl
String toolId = toolManager.getCurrentPlacement().getId();

String template = (String) getContext(data).get("template");
if (useSakaiGrader()) {
if (MODE_INSTRUCTOR_VIEW_STUDENTS_ASSIGNMENT.equals(state.getAttribute(FROM_VIEW))) {
context.put("method", "doView");
context.put("urlParams", "view=" + MODE_INSTRUCTOR_VIEW_STUDENTS_ASSIGNMENT);
} else {
context.put("method", "doGrade_assignment");
context.put("urlParams", "assignmentId=" + assignmentRef);
}
return template + TEMPLATE_INSTRUCTOR_GRADE_SUBMISSION_WITH_GRADER;
} else {
return template + TEMPLATE_INSTRUCTOR_GRADE_SUBMISSION;
}

} // build_instructor_grade_submission_context

private boolean useSakaiGrader() {
boolean useSakaiGrader = serverConfigurationService.getBoolean("assignment.usegraderbydefault", true);
Preferences prefs = preferencesService.getPreferences(sessionManager.getCurrentSessionUserId());
ResourceProperties props = prefs.getProperties("viewpreferences");
Expand All @@ -4359,14 +4374,8 @@ protected String build_instructor_grade_submission_context(VelocityPortlet portl
log.error("Failed to parse assignments view preferences", e);
}
}

if (useSakaiGrader) {
return template + TEMPLATE_INSTRUCTOR_GRADE_SUBMISSION_WITH_GRADER;
} else {
return template + TEMPLATE_INSTRUCTOR_GRADE_SUBMISSION;
}

} // build_instructor_grade_submission_context
return useSakaiGrader;
}

public class BasicUser {

Expand Down Expand Up @@ -13587,7 +13596,7 @@ private boolean alertGlobalNavigation(SessionState state, RunData data) {

if (MODE_STUDENT_VIEW_SUBMISSION.equals(mode) || MODE_STUDENT_PREVIEW_SUBMISSION.equals(mode) || MODE_STUDENT_CONFIRM_SUBMISSION.equals(mode)
|| MODE_STUDENT_VIEW_GRADE.equals(mode) || MODE_INSTRUCTOR_NEW_EDIT_ASSIGNMENT.equals(mode)
|| MODE_INSTRUCTOR_DELETE_ASSIGNMENT.equals(mode) || MODE_INSTRUCTOR_GRADE_SUBMISSION.equals(mode)
|| MODE_INSTRUCTOR_DELETE_ASSIGNMENT.equals(mode) || (MODE_INSTRUCTOR_GRADE_SUBMISSION.equals(mode) && !useSakaiGrader())
|| MODE_INSTRUCTOR_PREVIEW_GRADE_SUBMISSION.equals(mode) || MODE_INSTRUCTOR_PREVIEW_ASSIGNMENT.equals(mode)
|| MODE_INSTRUCTOR_VIEW_ASSIGNMENT.equals(mode) || MODE_INSTRUCTOR_REORDER_ASSIGNMENT.equals(mode)) {
if (state.getAttribute(ALERT_GLOBAL_NAVIGATION) == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
tool="assignments"
gradable-id="$assignment.Id"
submission-id="$submission.Id"
user-list-url="#toolLinkParam("$action" "doGrade_assignment" "assignmentId=$formattedText.escapeUrl($assignmentReference)")"
user-list-url="#toolLinkParam("$action" "$method" "$urlParams")"
current-student-id="$!submitterId"
has-associated-rubric="$!hasAssociatedRubric"
#if ($!hasAssociatedRubric)
Expand Down

0 comments on commit 8dbbfc9

Please sign in to comment.