fix(api): fix api integration for quest map and adjacent components
This commit is contained in:
@ -261,7 +261,7 @@ const TARGETED_XP = 15;
|
||||
const TARGETED_SCORE = 15;
|
||||
|
||||
const TargetedResults = ({ onFinish }: { onFinish: () => void }) => {
|
||||
const { userMetrics, setUserMetrics } = useExamConfigStore();
|
||||
const { userMetrics } = useExamConfigStore();
|
||||
const previousXP = userMetrics.xp ?? 0;
|
||||
const gainedXP = TARGETED_XP;
|
||||
const levelMinXP = Math.floor(previousXP / 100) * 100;
|
||||
@ -269,14 +269,6 @@ const TargetedResults = ({ onFinish }: { onFinish: () => void }) => {
|
||||
const currentLevel = Math.floor(previousXP / 100) + 1;
|
||||
const displayXP = useCountUp(gainedXP);
|
||||
|
||||
useEffect(() => {
|
||||
setUserMetrics({
|
||||
xp: previousXP,
|
||||
questions: 0,
|
||||
streak: 0,
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="results-screen">
|
||||
<style>{STYLES}</style>
|
||||
@ -397,20 +389,12 @@ export const Results = () => {
|
||||
const navigate = useNavigate();
|
||||
const results = useResults((s) => s.results);
|
||||
const clearResults = useResults((s) => s.clearResults);
|
||||
const { setUserMetrics, payload } = useExamConfigStore();
|
||||
const { payload } = useExamConfigStore();
|
||||
const isTargeted = payload?.mode === "TARGETED";
|
||||
|
||||
useEffect(() => {
|
||||
if (results)
|
||||
setUserMetrics({
|
||||
xp: results.total_xp,
|
||||
questions: results.correct_count,
|
||||
streak: 0,
|
||||
});
|
||||
}, [results]);
|
||||
|
||||
function handleFinishExam() {
|
||||
useExamConfigStore.getState().clearPayload();
|
||||
|
||||
clearResults();
|
||||
navigate("/student/home");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user