Skip to content

Commit

Permalink
SAK-43480 - Filtering wrong decimal separator characters in the new G… (
Browse files Browse the repository at this point in the history
sakaiproject#9373)

* SAK-43480 - Filtering wrong decimal separator characters in the new Grader respecting to user's locale

* SAK-43480 Simplified daniel's change a bit.

Co-authored-by: Adrian Fish <[email protected]>
  • Loading branch information
danielmerino and adrianfish authored Jun 22, 2021
1 parent a0b1db0 commit 81571be
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -800,9 +800,12 @@ export class SakaiGrader extends gradableDataMixin(SakaiElement) {

validateGradeInput(e) {

const decimalSeparator = (1.1).toLocaleString(portal.locale).substring(1, 2);
const rgxp = new RegExp(`[\\d${decimalSeparator}]`);

if (e.key === "Backspace" || e.key === "ArrowLeft" || e.key === "ArrowRight") {
return true;
} else if (!e.key.match(/[\d.,]/)) {
} else if (!e.key.match(rgxp)) {
e.preventDefault();
return false;
} else {
Expand All @@ -817,7 +820,7 @@ export class SakaiGrader extends gradableDataMixin(SakaiElement) {
}
}
}

gradeSelected(e) {

if (this.gradeScale === "CHECK_GRADE_TYPE") {
Expand Down

0 comments on commit 81571be

Please sign in to comment.