From a25e070b283d33a46e88829ec5bd0f3ac1857bf2 Mon Sep 17 00:00:00 2001 From: Tim Glasgow Date: Wed, 10 Aug 2022 23:35:22 -0500 Subject: [PATCH] timescore calculation error --- squarenotsquare/src/libs/CalculateScore.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/squarenotsquare/src/libs/CalculateScore.js b/squarenotsquare/src/libs/CalculateScore.js index 0dfc6c0..c3658ae 100644 --- a/squarenotsquare/src/libs/CalculateScore.js +++ b/squarenotsquare/src/libs/CalculateScore.js @@ -1,5 +1,10 @@ export function calculateSquareScore (answers, finalTime) { let timeScore = Math.round((60 - finalTime) * 1000); + + if (timeScore < 0) { + timeScore = 0; + } + let answerScore = answers * 1000; let finalScore = timeScore + answerScore; return finalScore;