From 8204866c9e56542045ef4c1734c08f96050de692 Mon Sep 17 00:00:00 2001 From: Pushyami Gundala Date: Wed, 13 Sep 2023 13:05:30 -0400 Subject: [PATCH] #1497 fix error message when all assignments are graded (#1534) --- assets/src/components/AssignmentGoalInput.js | 18 ++++++++---------- assets/src/containers/AssignmentPlanningV2.js | 3 +-- assets/src/hooks/useMathWarning.js | 6 +++--- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/assets/src/components/AssignmentGoalInput.js b/assets/src/components/AssignmentGoalInput.js index b34767656..c800e349f 100644 --- a/assets/src/components/AssignmentGoalInput.js +++ b/assets/src/components/AssignmentGoalInput.js @@ -76,16 +76,14 @@ function AssignmentGoalInput (props) { variant='outlined' style={{ marginRight: '10px', width: '25ch' }} /> - { - - } + ) } diff --git a/assets/src/containers/AssignmentPlanningV2.js b/assets/src/containers/AssignmentPlanningV2.js index e723ef922..a38dfe7ae 100644 --- a/assets/src/containers/AssignmentPlanningV2.js +++ b/assets/src/containers/AssignmentPlanningV2.js @@ -257,8 +257,7 @@ function AssignmentPlanningV2 (props) { handleInputFocus={handleInputFocus} handleInputBlur={handleInputBlur} /> - - ) + ) } - assignments.filter(a => !(a.graded || a.goalGradeSetByUser)).length === 0 +const allAssignmentsHasGoalGrade = assignments => + assignments.filter(a => !(a.goalGradeSetByUser)).length === 0 const useMathWarning = assignments => { const [showMathWarning, setShowMathWarning] = useState(false) useEffect(() => { - if (allAssignmentsAreGradedOrHasGoalGrade(assignments)) { + if (allAssignmentsHasGoalGrade(assignments)) { setShowMathWarning(true) } else { setShowMathWarning(false)