Remove unused imports and changed and improved layout design and responsiveness in some components and fixed some bugs.

This commit is contained in:
José Marques Lima
2025-02-02 23:58:23 +00:00
parent 54a9f6869a
commit 5a685ebe80
25 changed files with 1504 additions and 1031 deletions

View File

@@ -16,7 +16,6 @@ import useExamStore from "@/stores/exam";
import { findBy, mapBy, redirect, serialize } from "@/utils";
import { requestUser } from "@/utils/api";
import { getAssignmentsForStudent } from "@/utils/assignments.be";
import { getEntities } from "@/utils/entities.be";
import { getExamsByIds } from "@/utils/exams.be";
import { getGradingSystemByEntity } from "@/utils/grading.be";
import {
@@ -78,14 +77,12 @@ export const getServerSideProps = withIronSessionSsr(async ({ req, res }) => {
}),
]);
const assignmentsIDs = mapBy(assignments, "id");
const sessions = await getSessionsByUser(user.id, 10, {
["assignment.id"]: { $in: assignmentsIDs },
});
const formattedInvites = await Promise.all(
invites.map(convertInvitersToEntity)
);
const [sessions, ...formattedInvites] = await Promise.all([
getSessionsByUser(user.id, 10, {
["assignment.id"]: { $in: assignmentsIDs },
}),
...invites.map(convertInvitersToEntity),
]);
const examIDs = uniqBy(
assignments.reduce<{ module: Module; id: string; key: string }[]>(
@@ -110,7 +107,7 @@ export const getServerSideProps = withIronSessionSsr(async ({ req, res }) => {
props: serialize({
user,
assignments,
stats,
stats: stats ,
exams,
sessions,
invites: formattedInvites,
@@ -184,7 +181,7 @@ export default function Dashboard({
icon: (
<BsFileEarmarkText className="w-6 h-6 md:w-8 md:h-8 text-mti-red-light" />
),
value: stats.fullExams,
value: stats?.fullExams || 0,
label: "Exams",
tooltip: "Number of all conducted completed exams",
},
@@ -192,7 +189,7 @@ export default function Dashboard({
icon: (
<BsPencil className="w-6 h-6 md:w-8 md:h-8 text-mti-red-light" />
),
value: stats.uniqueModules,
value: stats?.uniqueModules || 0,
label: "Modules",
tooltip:
"Number of all exam modules performed including Level Test",