From 0d675d453748b24da4c748a6158b206dad4b548a Mon Sep 17 00:00:00 2001 From: Markus Stetschnig Date: Wed, 4 Oct 2023 14:38:00 +0200 Subject: [PATCH] S2U-34 Fixes --- .../org/sakaiproject/assignment/tool/AssignmentAction.java | 1 - .../org/sakaiproject/rubrics/impl/RubricsServiceImpl.java | 4 ++-- .../main/frontend/js/rubrics/sakai-rubrics-api-mixin.js | 7 +++---- 3 files changed, 5 insertions(+), 7 deletions(-) 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 c3d8f9c5aff3..a89783eb3d61 100644 --- a/assignment/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java +++ b/assignment/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java @@ -3839,7 +3839,6 @@ protected String build_instructor_grade_submission_context(VelocityPortlet portl String gradebookUid = toolManager.getCurrentPlacement().getContext(); // If the assignment reference is not equal to the associated gradebook item, then a custom gb item is being used if (!assignmentRef.equals(assignmentAssociateGradebook)) { - Optional assignmentOptional; try { org.sakaiproject.grading.api.Assignment gbAssignment = gradingService.getAssignment(gradebookUid, assignmentAssociateGradebook); diff --git a/rubrics/impl/src/main/java/org/sakaiproject/rubrics/impl/RubricsServiceImpl.java b/rubrics/impl/src/main/java/org/sakaiproject/rubrics/impl/RubricsServiceImpl.java index 6bb9661dd612..8e437bfccc19 100644 --- a/rubrics/impl/src/main/java/org/sakaiproject/rubrics/impl/RubricsServiceImpl.java +++ b/rubrics/impl/src/main/java/org/sakaiproject/rubrics/impl/RubricsServiceImpl.java @@ -873,7 +873,7 @@ public boolean hasAssociatedRubric(String tool, String id) { if (StringUtils.isBlank(id)) return false; - return associationRepository.findByToolIdAndItemId(tool, id).filter(canEvaluate.or(canEdit).or(isCreator)).isPresent(); + return getRubricAssociation(tool, id).isPresent(); } public Optional saveRubricAssociation(String toolId, String toolItemId, final Map params) { @@ -1015,7 +1015,7 @@ public Optional getRubricAssociation(String toolId, S @Transactional(readOnly = true) private Optional getRubricAssociationCheckPermission(String toolId, String associatedToolItemId) { - return getRubricAssociation(toolId, associatedToolItemId).filter(canEdit.or(isCreator)); + return getRubricAssociation(toolId, associatedToolItemId).filter(canEdit.or(isCreator).or(canEvaluate)); } @Transactional(readOnly = true) diff --git a/webcomponents/tool/src/main/frontend/js/rubrics/sakai-rubrics-api-mixin.js b/webcomponents/tool/src/main/frontend/js/rubrics/sakai-rubrics-api-mixin.js index 124d871e60e6..e211e10b23ad 100644 --- a/webcomponents/tool/src/main/frontend/js/rubrics/sakai-rubrics-api-mixin.js +++ b/webcomponents/tool/src/main/frontend/js/rubrics/sakai-rubrics-api-mixin.js @@ -30,14 +30,13 @@ export const rubricsApiMixin = Base => class extends Base { apiGetEvaluation() { - - const url = new URL(`/api/sites/${this.siteId}/rubric-evaluations/tools/${this.toolId}/items/${this.entityId}/evaluations/${this.evaluatedItemId}`); + let url = `/api/sites/${this.siteId}/rubric-evaluations/tools/${this.toolId}/items/${this.entityId}/evaluations/${this.evaluatedItemId}/owners/${this.evaluatedItemOwnerId}`; if (this.isPeerOrSelf) { - url.searchParams.append("isPeer", true); + url += "?isPeer=true"; } - return fetch(url.href, { credentials: "include" }) + return fetch(url, { credentials: "include" }) .then(r => { if (r.ok) {