From 9239068cde82315060c5eed55184f1038e087fda Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Mon, 2 Oct 2023 14:16:34 +0100 Subject: [PATCH] Updated the stats page a bit more --- src/exams/Selection.tsx | 2 +- src/pages/(admin)/Lists/GroupList.tsx | 1 + src/pages/stats.tsx | 80 +++++++++++++++++++++++++-- 3 files changed, 77 insertions(+), 6 deletions(-) diff --git a/src/exams/Selection.tsx b/src/exams/Selection.tsx index 5b30da2b..c7a3f44f 100644 --- a/src/exams/Selection.tsx +++ b/src/exams/Selection.tsx @@ -19,7 +19,7 @@ interface Props { export default function Selection({user, onStart, disableSelection = false}: Props) { const [selectedModules, setSelectedModules] = useState([]); - const [avoidRepeatedExams, setAvoidRepeatedExams] = useState(false); + const [avoidRepeatedExams, setAvoidRepeatedExams] = useState(true); const {stats} = useStats(user?.id); const toggleModule = (module: Module) => { diff --git a/src/pages/(admin)/Lists/GroupList.tsx b/src/pages/(admin)/Lists/GroupList.tsx index 93bfb9af..9469b436 100644 --- a/src/pages/(admin)/Lists/GroupList.tsx +++ b/src/pages/(admin)/Lists/GroupList.tsx @@ -244,6 +244,7 @@ export default function GroupList({user}: {user: User}) { if (result) { setShowDisclosure(false); setEditingID(undefined); + reload(); } }); }} diff --git a/src/pages/stats.tsx b/src/pages/stats.tsx index 73aaa604..5074c4f4 100644 --- a/src/pages/stats.tsx +++ b/src/pages/stats.tsx @@ -50,6 +50,7 @@ export default function Stats() { const {users} = useUsers(); const {groups} = useGroups(user?.id); const {stats} = useStats(statsUserId); + const {stats: userStats} = useStats(user?.id); useEffect(() => { if (user) setStatsUserId(user.id); @@ -132,7 +133,7 @@ export default function Stats() {
- {Object.keys(groupBySession(stats)).length} + {Object.keys(groupBySession(userStats)).length} Exams
@@ -141,7 +142,7 @@ export default function Stats() {
- {stats.length} + {userStats.length} Exercises
@@ -150,7 +151,7 @@ export default function Stats() {
- {averageScore(stats)}% + {averageScore(userStats)}% Average Score
@@ -245,7 +246,75 @@ export default function Stats() { -
+ {/* Module Score */} +
+ Module Score Bands +
+
+
+ + {user.levels.reading} of{" "} + {user.desiredLevels.reading} + + Reading +
+ +
+
+
+ + {user.levels.listening} of{" "} + {user.desiredLevels.listening} + + Listening +
+ +
+
+
+ + {user.levels.writing} of{" "} + {user.desiredLevels.writing} + + Writing +
+ +
+
+
+ + {user.levels.speaking} of{" "} + {user.desiredLevels.speaking} + + Speaking +
+ +
+
+
+ + {/* Total Score Band per Session */} +
Total Score Band per Session
-
+ {/* Module Score Band per Session */} +
Module Score Band per Session