From b36ed0a27f25697990f77112c57842ac21fbd72a Mon Sep 17 00:00:00 2001 From: Jonah Paten Date: Tue, 27 Feb 2024 17:43:57 -0800 Subject: [PATCH] Made the answer depend on the "left" or "right" value in the question (#88) --- src/components/shared/Exercises/UnitCircleInput.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/shared/Exercises/UnitCircleInput.tsx b/src/components/shared/Exercises/UnitCircleInput.tsx index 7ed8563..2a4140c 100644 --- a/src/components/shared/Exercises/UnitCircleInput.tsx +++ b/src/components/shared/Exercises/UnitCircleInput.tsx @@ -61,7 +61,7 @@ function UnitCircleInput({ nextExercise(); } - const answers: string[][] = []; + const answers: number[][] = []; const questionLabels: string[][] = []; const questionDirections: string[][] = []; for (let i = 0; i < markers.length; i++) { @@ -71,7 +71,11 @@ function UnitCircleInput({ const length = markers[i].length; for (let j = 0; j < length; j++) { if (labels[i][j] !== '') { - currentAnswers.push(markers[i][j].slice(0, -1)); + let multiplier = 1; + if (directions[i][j] == 'left') { + multiplier = -1; + } + currentAnswers.push(parseInt(markers[i][j].slice(0, -1)) * multiplier); currentLabels.push(labels[i][j]); currentDirections.push(directions[i][j]); }