Skip to content

SAK-50907 Assignments add option to replicate the self-report rubric to the grading rubric#13229

Closed
st-manu wants to merge 1 commit intosakaiproject:masterfrom
st-manu:SAK-50907
Closed

SAK-50907 Assignments add option to replicate the self-report rubric to the grading rubric#13229
st-manu wants to merge 1 commit intosakaiproject:masterfrom
st-manu:SAK-50907

Conversation

@st-manu
Copy link
Contributor

@st-manu st-manu commented Jan 23, 2025

https://sakaiproject.atlassian.net/browse/SAK-50907

Add the option to replicate the self-report rubric to the grading rubric.
clasic
new

@ern ern changed the title SAK-50907 Assignments: New option to replicate the self-report rubric to the grading rubric SAK-50907 Assignments add option to replicate the self-report rubric to the grading rubric Jan 28, 2025
Copy link
Contributor

@adrianfish adrianfish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually think that this should all happen on the server. It should be a service call on the rubrics service. All you are doing, effectively, is copying an evaluation to another and it would be way more reliable to do this server side, with some unit tests. Calling into the rubric web component like you have will probably break at some point in the future.

ASN.toggleAutoAnnounceEstimate(false);
}

ASN.autocompleteRubricWithSelfReport = function(event) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is a brand new function, you should probably use a two space indentation. It's what we use in all the webcomponents and what we specify in our eslint config.

Comment on lines +1024 to +1033
const evaluationDetails = [];
const criterionRows = studentRubric.querySelectorAll(".criterion-row");
criterionRows.forEach(row => {
const criterionId = row.id.split("_").pop();
const selectedRating = row.querySelector(".rating-item.selected");
if (selectedRating) {
const selectedRatingId = selectedRating.id.split("-").pop();
evaluationDetails.push({ criterionId, selectedRatingId });
}
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const evaluationDetails = [];
const criterionRows = studentRubric.querySelectorAll(".criterion-row");
criterionRows.forEach(row => {
const criterionId = row.id.split("_").pop();
const selectedRating = row.querySelector(".rating-item.selected");
if (selectedRating) {
const selectedRatingId = selectedRating.id.split("-").pop();
evaluationDetails.push({ criterionId, selectedRatingId });
}
});
const evaluationDetails = [...studentRubric.querySelectorAll(".criterion-row")].reduce(acc, row) => {
const selectedRatingId = row.querySelector(".rating-item.selected")?.id.split("-").pop();
selectedRatingId && acc.push({ criterionId: row.id.split("_").pop(), selectedRatingId });
return acc;
}, []);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm spreading the NodeList into an array and then reducing the array. I'm using optional chaining to remove some of the variables you had introduced.

Comment on lines +1047 to +1064
evaluationDetails.forEach(detail => {
const criterionRow = gradingRubric.querySelector(`#criterion_row_${detail.criterionId}`);
if (criterionRow) {
const ratingItem = criterionRow.querySelector(`.rating-item[data-rating-id="${detail.selectedRatingId}"]`);
if (ratingItem) {
ratingItem.click();
const pointsElement = ratingItem.querySelector(".points");
const pointsText = pointsElement.textContent.trim();
let points = parseFloat(pointsText.replace(",", "."));
const pointsInParentheses = pointsElement.querySelector("b");
if (pointsInParentheses) {
const pointsInParenthesesText = pointsInParentheses.textContent.trim().replace(/[()]/g, '');
points = parseFloat(pointsInParenthesesText.replace(",", "."));
}
totalPoints += points;
}
}
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole block should go into the rubric code somewhere. It seems a bit fragile, especially selecting the bold tag to find the points in parentheses. You could move the code into rubrics and add a unit test.

@bbbbgarcia bbbbgarcia marked this pull request as draft March 25, 2025 14:34
@github-actions
Copy link

github-actions bot commented Nov 1, 2025

This PR has been automatically marked as stale due to 10 days of inactivity. It will be closed in 4 days unless there is new activity.

@github-actions github-actions bot added the stale label Nov 1, 2025
@github-actions
Copy link

github-actions bot commented Nov 6, 2025

This PR has been automatically closed due to inactivity after being marked as stale. You may simply reopen it and continue working on it.

@github-actions github-actions bot closed this Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants