ENCOA-239: Bug: Corporate after viewing assignment the dashboard button forwards the account to the wrong view
This commit is contained in:
@@ -54,7 +54,7 @@ export default function Finish({ user, practiceScores, scores, modules, informat
|
||||
const [selectedScore, setSelectedScore] = useState<Score>(scores.find((x) => x.module === modules[0])!);
|
||||
const [selectedPracticeScore, setSelectedPracticeScore] = useState<Score | undefined>(practiceScores.find((x) => x.module === modules[0]));
|
||||
const [isExtraInformationOpen, setIsExtraInformationOpen] = useState(false);
|
||||
const {selectedModules, exams, dispatch} = useExamStore((s) => s);
|
||||
const { selectedModules, exams, dispatch } = useExamStore((s) => s);
|
||||
|
||||
const aiUsage = Math.round(ai_usage(solutions) * 100);
|
||||
|
||||
@@ -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) => {
|
||||
@@ -114,7 +119,7 @@ export default function Finish({ user, practiceScores, scores, modules, informat
|
||||
};
|
||||
|
||||
const handlePlayAgain = () => {
|
||||
dispatch({type: "INIT_EXAM", payload: {exams, modules: selectedModules}})
|
||||
dispatch({ type: "INIT_EXAM", payload: { exams, modules: selectedModules } })
|
||||
router.push(destination || "/exam")
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user