feat: implement quiz results tracking and caching for user tests
All checks were successful
On Push to Main / test (push) Successful in 47s
On Push to Main / publish (push) Successful in 1m27s
On Push to Main / deploy-dev (push) Successful in 2m7s

This commit is contained in:
RaymondVerhoef
2026-05-27 10:05:56 +02:00
parent 07af2783dc
commit 3aa32c383e
3 changed files with 199 additions and 10 deletions

View File

@@ -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 ──────────────────────────────────────────