From 52d309e7f488344a5749315901a358877d10c24e Mon Sep 17 00:00:00 2001 From: Joao Ramos Date: Sat, 17 Feb 2024 10:43:55 +0000 Subject: [PATCH] Fixed NaN display on level progress --- src/dashboards/Student.tsx | 56 ++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/src/dashboards/Student.tsx b/src/dashboards/Student.tsx index 28c0385c..c22915c0 100644 --- a/src/dashboards/Student.tsx +++ b/src/dashboards/Student.tsx @@ -227,35 +227,39 @@ export default function StudentDashboard({user}: Props) {
Score History
- {MODULE_ARRAY.map((module) => ( -
-
-
- {module === "reading" && } - {module === "listening" && } - {module === "writing" && } - {module === "speaking" && } - {module === "level" && } + {MODULE_ARRAY.map((module) => { + const desiredLevel = user.desiredLevels[module] || 9; + const level = user.levels[module] || 0; + return ( +
+
+
+ {module === "reading" && } + {module === "listening" && } + {module === "writing" && } + {module === "speaking" && } + {module === "level" && } +
+
+ {capitalize(module)} + + Level {level} / Level 9 (Desired Level: {desiredLevel}) + +
-
- {capitalize(module)} - - Level {user.levels[module] || 0} / Level 9 (Desired Level: {user.desiredLevels[module] || 9}) - +
+
-
- -
-
- ))} + ); + })}