ENCOA-239: Bug: Corporate after viewing assignment the dashboard button forwards the account to the wrong view

This commit is contained in:
Tiago Ribeiro
2024-11-29 16:20:05 +00:00
parent 5cfd2c90b7
commit 0faa908538

View File

@@ -98,6 +98,11 @@ export default function Finish({ user, practiceScores, scores, modules, informat
return exam.exercises.length;
};
const clickDashboard = () => {
if (user.type !== "student") return router.back()
destination === "/exam" ? router.reload() : router.push(destination || "/")
}
const bandScore: number = calculateBandScore(selectedScore.correct, selectedScore.total, selectedModule, user.focus);
const showLevel = (level: number) => {
@@ -344,7 +349,7 @@ export default function Finish({ user, practiceScores, scores, modules, informat
)}
</div>
<Button onClick={() => destination === "/exam" ? router.reload() : router.push(destination || "/")} color="purple" className="w-full max-w-[200px] self-end">
<Button onClick={clickDashboard} color="purple" className="w-full max-w-[200px] self-end">
Dashboard
</Button>
</div>