Skip to content

Commit

Permalink
Merge pull request #535 from uw-it-aca/task/default-grade
Browse files Browse the repository at this point in the history
set default grade for incomplete
  • Loading branch information
jlaney authored Nov 22, 2024
2 parents d622473 + 660f602 commit edd836a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
11 changes: 9 additions & 2 deletions course_grader_vue/components/grade/input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
:value="grade"
:disabled="student.is_submitted"
:placeholder="gradePlaceholder"
@change="gradeChanged($event.target.value)"
:aria-controls="`grade-${student.item_id}-menu`"
data-bs-toggle="dropdown"
@change="gradeChanged($event.target.value)"
@keydown.tab.exact="false"
@keydown.down.exact="openMenu"
/>
Expand Down Expand Up @@ -122,7 +122,11 @@
<script>
import { useGradeStore } from "@/stores/grade";
import { updateGrade } from "@/utils/data";
import { incompleteBlocklist, normalizeGrade } from "@/utils/grade";
import {
incompleteBlocklist,
normalizeGrade,
normalizeDefaultGrade,
} from "@/utils/grade";
export default {
props: {
Expand Down Expand Up @@ -194,6 +198,9 @@ export default {
incompleteChanged: function (checked) {
this.incomplete = checked;
this.updateGradeChoices();
if (checked) {
this.grade = normalizeDefaultGrade(this.grade, this.actualChoices);
}
this.saveGrade();
},
writingChanged: function (checked) {
Expand Down
8 changes: 8 additions & 0 deletions course_grader_vue/utils/grade.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ function normalizeGrade(grade) {
return grade;
}

function normalizeDefaultGrade(grade, choices) {
if (grade === "" || incompleteBlocklist.includes(grade)) {
return choices.includes("0.0")
? "0.0" : choices.includes("NC") ? "NC" : "";
}
}

function validateGrade(grade, incomplete, choices) {
var is_hypenated,
is_cnc,
Expand Down Expand Up @@ -96,5 +103,6 @@ function validateGrade(grade, incomplete, choices) {
export {
incompleteBlocklist,
normalizeGrade,
normalizeDefaultGrade,
validateGrade,
};
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
'uw-django-saml2~=1.8',
'uw-memcached-clients~=1.0',
'uw-restclients-core~=1.4',
'uw-restclients-sws~=2.3',
'uw-restclients-sws~=2.4',
'uw-restclients-pws~=2.1',
'uw-restclients-canvas~=1.2',
'uw-restclients-graderoster~=1.1',
Expand Down

0 comments on commit edd836a

Please sign in to comment.