feat: implement quiz results tracking and caching for user tests
This commit is contained in:
@@ -7,6 +7,7 @@ import Button from '../components/ui/Button';
|
||||
import Tag from '../components/ui/Tag';
|
||||
import { useApp } from '../store/AppContext';
|
||||
import { getAssignedTopic } from '../lib/learningService';
|
||||
import { generateWeeklyQuiz } from '../lib/testService';
|
||||
import { getYearProgress, getCurriculumCycle, getCurriculumWeek, getActiveVersion, getCurrentWeekContent } from '../lib/curriculumService';
|
||||
import * as db from '../lib/db';
|
||||
import MicroLearningSelector from '../components/micro_learning/MicroLearningSelector';
|
||||
@@ -86,6 +87,13 @@ const Leren = () => {
|
||||
|
||||
const handleTopicCompleted = () => {
|
||||
setSessionDone(true);
|
||||
// Pre-generate this week's test questions in the background so they are
|
||||
// ready in localStorage by the time the user navigates to /test. The call
|
||||
// is fire-and-forget — a failure here is harmless; the test page will just
|
||||
// generate on demand as before.
|
||||
if (state.currentUser) {
|
||||
generateWeeklyQuiz(state.currentUser.id, state.weekNumber).catch(() => {});
|
||||
}
|
||||
};
|
||||
|
||||
// ── Detail View ──────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user