diff --git a/src/components/GradesView/EditModal/OverrideTable/AdjustedGradeInput/hooks.js b/src/components/GradesView/EditModal/OverrideTable/AdjustedGradeInput/hooks.js index da315857..9e3ee891 100644 --- a/src/components/GradesView/EditModal/OverrideTable/AdjustedGradeInput/hooks.js +++ b/src/components/GradesView/EditModal/OverrideTable/AdjustedGradeInput/hooks.js @@ -8,13 +8,25 @@ const useAdjustedGradeInputData = () => { const hintText = possibleGrade && ` ${getLocalizedSlash()} ${possibleGrade}`; const onChange = ({ target }) => { - setModalState({ adjustedGradeValue: target.value }); + let adjustedGradeValue; + switch (true) { + case target.value < 0: + adjustedGradeValue = 0; + break; + case possibleGrade && target.value > possibleGrade: + adjustedGradeValue = possibleGrade; + break; + default: + adjustedGradeValue = target.value; + } + setModalState({ adjustedGradeValue }); }; return { value, onChange, hintText, + possibleGrade, }; }; diff --git a/src/components/GradesView/EditModal/OverrideTable/AdjustedGradeInput/index.jsx b/src/components/GradesView/EditModal/OverrideTable/AdjustedGradeInput/index.jsx index d070b9b5..5c2c4c4c 100644 --- a/src/components/GradesView/EditModal/OverrideTable/AdjustedGradeInput/index.jsx +++ b/src/components/GradesView/EditModal/OverrideTable/AdjustedGradeInput/index.jsx @@ -14,12 +14,15 @@ export const AdjustedGradeInput = () => { value, onChange, hintText, + possibleGrade, } = useAdjustedGradeInputData(); return (