From 7a1df1b14745ad84551824a581e42c6bf4faab0c Mon Sep 17 00:00:00 2001 From: Aniii10 Date: Thu, 26 Sep 2024 12:45:06 +0200 Subject: [PATCH] SAK-50171:Assignments: Rubrics are not published when pressing Release Grades --- .../webapi/controllers/RubricsRestController.java | 1 + .../sakai-rubrics/src/SakaiRubricStudentButton.js | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/webapi/src/main/java/org/sakaiproject/webapi/controllers/RubricsRestController.java b/webapi/src/main/java/org/sakaiproject/webapi/controllers/RubricsRestController.java index 06dfcf9dc47a..721ea7590075 100644 --- a/webapi/src/main/java/org/sakaiproject/webapi/controllers/RubricsRestController.java +++ b/webapi/src/main/java/org/sakaiproject/webapi/controllers/RubricsRestController.java @@ -347,6 +347,7 @@ ResponseEntity patchEvaluation(@PathVariable String siteId, @PathVariable Long e return rubricsService.getEvaluation(evaluationId, siteId).map(evaluation -> { ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.registerModule(new JavaTimeModule()); try { JsonNode patched = patch.apply(objectMapper.convertValue(evaluation, JsonNode.class)); diff --git a/webcomponents/tool/src/main/frontend/packages/sakai-rubrics/src/SakaiRubricStudentButton.js b/webcomponents/tool/src/main/frontend/packages/sakai-rubrics/src/SakaiRubricStudentButton.js index 28cf6aeee50c..6814ac546756 100644 --- a/webcomponents/tool/src/main/frontend/packages/sakai-rubrics/src/SakaiRubricStudentButton.js +++ b/webcomponents/tool/src/main/frontend/packages/sakai-rubrics/src/SakaiRubricStudentButton.js @@ -90,16 +90,16 @@ export class SakaiRubricStudentButton extends rubricsApiMixin(RubricsElement) { return null; }) - .then(async data => { - - const evaluation = data._embedded.evaluations[0]; + .then(async evaluation => { if (evaluation) { - evaluation.status = 2; + const evaluationStatus = 2; url = `/api/sites/${this.siteId}/rubric-evaluations/${evaluation.id}`; await fetch(url, { - body: JSON.stringify(evaluation), + body: JSON.stringify([ + { "op": "replace", "path": "/status", "value": evaluationStatus } + ]), credentials: "include", - headers: { "Content-Type": "application/json" }, + headers: { "Content-Type": "application/json-patch+json" }, method: "PATCH", }) .then(r => {