diff --git a/client/src/pages/presentationEditor/components/slideSettingsComponents/QuestionSettings.tsx b/client/src/pages/presentationEditor/components/slideSettingsComponents/QuestionSettings.tsx index a9f9c1950e4940ea4b10b8611cd2655ac86466a1..fb70e055dfc4858062a9123cf56dcb66fd6decdd 100644 --- a/client/src/pages/presentationEditor/components/slideSettingsComponents/QuestionSettings.tsx +++ b/client/src/pages/presentationEditor/components/slideSettingsComponents/QuestionSettings.tsx @@ -45,7 +45,8 @@ const QuestionSettings = ({ activeSlide, competitionId }: QuestionSettingsProps) }) .catch(console.log) } else { - const score = Math.min(+event.target.value, maxScore) + // Sets score to event.target.value if it's between 0 and max + const score = Math.max(0, Math.min(+event.target.value, maxScore)) setScore(score) await axios .put(`/api/competitions/${competitionId}/slides/${activeSlide.id}/questions/${activeSlide.questions[0].id}`, { diff --git a/client/src/pages/presentationEditor/components/slideSettingsComponents/Timer.tsx b/client/src/pages/presentationEditor/components/slideSettingsComponents/Timer.tsx index f8d871d04190fdb7d65ff0d544eeaf28766ee187..086a64a480c1f7d6de820d91c03d47cb327c1467 100644 --- a/client/src/pages/presentationEditor/components/slideSettingsComponents/Timer.tsx +++ b/client/src/pages/presentationEditor/components/slideSettingsComponents/Timer.tsx @@ -27,7 +27,8 @@ const Timer = ({ activeSlide, competitionId }: TimerProps) => { const updateTimer = async (event: React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>) => { /** If timer value is above the max value, set the timer value to max value to not overflow the server */ - const timerValue = Math.min(+event.target.value, maxTime) + // Sets score to event.target.value if it's between 0 and max + const timerValue = Math.max(0, Math.min(+event.target.value, maxTime)) if (activeSlide) { setTimer(timerValue) await axios