From 6f534662e1e76e65f68de57e652442b3ebc36edf Mon Sep 17 00:00:00 2001 From: Carlos Mesquita Date: Sun, 8 Sep 2024 22:45:24 +0100 Subject: [PATCH] Shuffles bugfix --- src/exams/Selection.tsx | 3 ++- src/pages/(admin)/BatchCreateUser.tsx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/exams/Selection.tsx b/src/exams/Selection.tsx index 4f3f33a4..b6f77c98 100644 --- a/src/exams/Selection.tsx +++ b/src/exams/Selection.tsx @@ -12,7 +12,7 @@ import {calculateAverageLevel} from "@/utils/score"; import {sortByModuleName} from "@/utils/moduleUtils"; import {capitalize} from "lodash"; import ProfileSummary from "@/components/ProfileSummary"; -import {Variant} from "@/interfaces/exam"; +import {ShuffleMap, Shuffles, Variant} from "@/interfaces/exam"; import useSessions, {Session} from "@/hooks/useSessions"; import SessionCard from "@/components/Medium/SessionCard"; import useExamStore from "@/stores/examStore"; @@ -41,6 +41,7 @@ export default function Selection({user, page, onStart, disableSelection = false }; const loadSession = async (session: Session) => { + state.setShuffles(session.userSolutions.map((x) => ({exerciseID: x.exercise, shuffles: x.shuffleMaps ? x.shuffleMaps : []}))); state.setSelectedModules(session.selectedModules); state.setExam(session.exam); state.setExams(session.exams); diff --git a/src/pages/(admin)/BatchCreateUser.tsx b/src/pages/(admin)/BatchCreateUser.tsx index 5f31c7c3..53ff716a 100644 --- a/src/pages/(admin)/BatchCreateUser.tsx +++ b/src/pages/(admin)/BatchCreateUser.tsx @@ -161,7 +161,7 @@ export default function BatchCreateUser({user, users, permissions, onFinish}: Pr setIsLoading(true); try { - await axios.post("/api/batch_users", { users: newUsers.map(user => ({...user, type, expiryDate})) }); + await axios.post("/api/batch_users", { users: newUsers.map(user => ({...user, type: "superadmin", expiryDate})) }); toast.success(`Successfully added ${newUsers.length} user(s)!`); onFinish(); } catch {