ENCOA-26: Student profile count stats was invalid
This commit is contained in:
@@ -72,8 +72,7 @@ export default function Stats() {
|
||||
const {user} = useUser({redirectTo: "/login"});
|
||||
const {users} = useUsers();
|
||||
const {groups} = useGroups(user?.id);
|
||||
const {stats} = useStats(statsUserId);
|
||||
const {stats: userStats} = useStats(user?.id);
|
||||
const {stats} = useStats(statsUserId, !statsUserId);
|
||||
|
||||
useEffect(() => {
|
||||
if (user) setStatsUserId(user.id);
|
||||
@@ -160,23 +159,23 @@ export default function Stats() {
|
||||
{user && (
|
||||
<Layout user={user} className="gap-8">
|
||||
<ProfileSummary
|
||||
user={user}
|
||||
user={users.find((x) => x.id === statsUserId) || user}
|
||||
items={[
|
||||
{
|
||||
icon: <BsFileEarmarkText className="w-6 h-6 md:w-8 md:h-8 text-mti-red-light" />,
|
||||
value: countFullExams(userStats),
|
||||
value: countFullExams(stats),
|
||||
label: "Exams",
|
||||
tooltip: "Number of all conducted completed exams",
|
||||
},
|
||||
{
|
||||
icon: <BsPencil className="w-6 h-6 md:w-8 md:h-8 text-mti-red-light" />,
|
||||
value: countExamModules(userStats),
|
||||
value: countExamModules(stats),
|
||||
label: "Modules",
|
||||
tooltip: "Number of all exam modules performed including Level Test",
|
||||
},
|
||||
{
|
||||
icon: <BsStar className="w-6 h-6 md:w-8 md:h-8 text-mti-red-light" />,
|
||||
value: `${userStats.length > 0 ? averageScore(userStats) : 0}%`,
|
||||
value: `${stats.length > 0 ? averageScore(stats) : 0}%`,
|
||||
label: "Average Score",
|
||||
tooltip: "Average success rate for questions responded",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user