Updated the stats

This commit is contained in:
Tiago Ribeiro
2024-04-02 00:25:49 +01:00
parent bddb2ed18e
commit 46764cacfa
4 changed files with 47 additions and 17 deletions

View File

@@ -14,7 +14,7 @@ import {Module} from "@/interfaces";
import ProgressBar from "@/components/Low/ProgressBar";
import Layout from "@/components/High/Layout";
import {calculateAverageLevel, calculateBandScore} from "@/utils/score";
import {MODULE_ARRAY, sortByModule} from "@/utils/moduleUtils";
import {countExamModules, countFullExams, MODULE_ARRAY, sortByModule} from "@/utils/moduleUtils";
import {Chart} from "react-chartjs-2";
import useUsers from "@/hooks/useUsers";
import Select from "react-select";
@@ -39,7 +39,7 @@ export const getServerSideProps = withIronSessionSsr(({req, res}) => {
redirect: {
destination: "/login",
permanent: false,
}
},
};
}
@@ -48,7 +48,7 @@ export const getServerSideProps = withIronSessionSsr(({req, res}) => {
redirect: {
destination: "/",
permanent: false,
}
},
};
}
@@ -164,21 +164,21 @@ export default function Stats() {
items={[
{
icon: <BsFileEarmarkText className="w-6 h-6 md:w-8 md:h-8 text-mti-red-light" />,
value: Object.keys(groupBySession(userStats)).length,
value: countFullExams(userStats),
label: "Exams",
tooltip: 'Number of all conducted completed 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: userStats.length,
label: "Exercises",
tooltip: 'Number of all conducted exercises including Level Test',
value: countExamModules(userStats),
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}%`,
label: "Average Score",
tooltip: 'Average success rate for questions responded',
tooltip: "Average success rate for questions responded",
},
]}
/>