MDL-78217 grade: Fixing invalid input as early as possible

This commit is contained in:
Shamim Rezaie 2023-09-22 19:40:13 +10:00
parent c428c0195a
commit 7b8aa2daf1
3 changed files with 3 additions and 3 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -287,7 +287,7 @@ export const init = (decSep, oldCalculation) => {
// This is only required if we are using natural weights.
if (parseInt(categoryElement.dataset.aggregation) === grade.aggregation.sum) {
const weightElement = gradeItemRow.querySelector(selectors.weightOverrideInput);
weightElement.value = formatFloat(parseWeight(weightElement.value));
weightElement.value = formatFloat(Math.max(0, parseWeight(weightElement.value)));
recalculateNaturalWeights(categoryElement);
}
}