diff --git a/rubrics/tool/src/main/frontend/webcomponents/sakai-rubric-criteria-grading.js b/rubrics/tool/src/main/frontend/webcomponents/sakai-rubric-criteria-grading.js index 1f4b40887d54..d143fb57f741 100644 --- a/rubrics/tool/src/main/frontend/webcomponents/sakai-rubric-criteria-grading.js +++ b/rubrics/tool/src/main/frontend/webcomponents/sakai-rubric-criteria-grading.js @@ -239,28 +239,28 @@ export class SakaiRubricCriteriaGrading extends SakaiElement { var criterion = this.criteria.filter(c => c.id == criterionId)[0]; var rating = criterion.ratings.filter(r => r.id == ratingId)[0]; - criterion.selectedvalue = rating.points; - criterion.selectedRatingId = rating.id; - criterion.pointoverride = rating.points.toString(); - - var criterionRow = this.querySelector(`#criterion_row_${criterion.id}`); - var ratingElements = criterionRow.querySelectorAll('.rating-item'); var clickedRatingElement = this.querySelector(`#rating-item-${ratingId}`); if (clickedRatingElement.classList.contains("selected")) { clickedRatingElement.classList.remove("selected"); criterion.selectedvalue = 0; criterion.selectedRatingId = ""; + criterion.pointoverride = "0"; } else { + var ratingElements = this.querySelectorAll(`#criterion_row_${criterion.id} .rating-item`); ratingElements.forEach(i => i.classList.remove('selected')); clickedRatingElement.classList.add("selected"); criterion.selectedvalue = rating.points; criterion.selectedRatingId = rating.id; + criterion.pointoverride = rating.points.toString(); } - var pointsInput = this.querySelector(`#rbcs-${this.evaluatedItemId}-${this.entityId}-criterion-override-${criterionId}`); - if (pointsInput) { - pointsInput.value = rating.points; - } + var selector + = `#rbcs-${this.evaluatedItemId.replace(/./g, "\\.")}-${this.entityId.replace(/./g, "\\.")}-criterion-override-${criterionId}`; + var overrideInput = this.querySelector(selector); + if (overrideInput) overrideInput.value = rating.points; + + // Whenever a rating is clicked, either to select or deselect, it cancels out any override so we + // remove the strike out from the clicked points value this.querySelector(`#points-display-${criterionId}`).classList.remove("strike"); var detail = { evaluatedItemId: this.evaluatedItemId, entityId: this.entityId, criterionId: criterionId, value: criterion.selectedvalue }; diff --git a/rubrics/tool/src/main/frontend/webcomponents/sakai-rubric-grading.js b/rubrics/tool/src/main/frontend/webcomponents/sakai-rubric-grading.js index 8a6d35f4a575..4af40f3f5fb5 100644 --- a/rubrics/tool/src/main/frontend/webcomponents/sakai-rubric-grading.js +++ b/rubrics/tool/src/main/frontend/webcomponents/sakai-rubric-grading.js @@ -102,4 +102,6 @@ export class SakaiRubricGrading extends SakaiElement { } } -customElements.define("sakai-rubric-grading", SakaiRubricGrading); +try { + customElements.define("sakai-rubric-grading", SakaiRubricGrading); +} catch (error) { /* That's okay */ } diff --git a/samigo/samigo-app/src/webapp/jsf/evaluation/gradeStudentResult.jsp b/samigo/samigo-app/src/webapp/jsf/evaluation/gradeStudentResult.jsp index 5edf5bbddbf0..7d3eaf17d4db 100755 --- a/samigo/samigo-app/src/webapp/jsf/evaluation/gradeStudentResult.jsp +++ b/samigo/samigo-app/src/webapp/jsf/evaluation/gradeStudentResult.jsp @@ -114,7 +114,7 @@ function toPoint(id) e.stopPropagation(); - var itemId = $(e.target).parent().attr("itemId"); + var itemId = $(e.target).parent().attr("item-id"); var gradeField = $('.adjustedScore' + itemId); if (gradeField) { gradeField.val(e.detail.value); diff --git a/samigo/samigo-app/src/webapp/jsf/evaluation/questionScore.jsp b/samigo/samigo-app/src/webapp/jsf/evaluation/questionScore.jsp index 21a1390fc4d4..1494d25e075f 100755 --- a/samigo/samigo-app/src/webapp/jsf/evaluation/questionScore.jsp +++ b/samigo/samigo-app/src/webapp/jsf/evaluation/questionScore.jsp @@ -60,7 +60,7 @@ function downloadAll(url){ $('body').on('total-points-updated', function (e) { e.stopPropagation(); - var itemId = e.target.parentElement.getAttribute("itemid"); + var itemId = e.target.parentElement.getAttribute("item-id"); var points = e.detail.value;