fix(dashboard): DPP tags properly dynamic based on user target exam

This commit is contained in:
2026-07-08 12:46:44 +05:30
parent c87b305646
commit 1a6168f724
28 changed files with 853 additions and 304 deletions

View File

@@ -36,6 +36,7 @@ export interface ExamAttemptPayload {
question_id: string
selected_answer: string | null
is_correct: boolean // Typically evaluated on server, but requested in payload structure
is_subjective: boolean
time_spent: number
}>
score: number
@@ -200,16 +201,17 @@ export const useCBTStore = create<CBTState>()(
const timeTaken = Math.floor((Date.now() - state.startTime) / 1000);
const answerList = Object.values(state.answers);
// Mock evaluation (In reality, server does this)
let correctCount = 0;
// Backend will perform secure evaluation
let correctCount = 0; // Removing mock count
const finalAnswers = answerList.map(a => {
// Assuming 'A' is correct for dummy data
const isCorrect = a.selected_answer === 'A';
if (isCorrect) correctCount++;
const q = state.questions.find(quest => quest.id === a.question_id);
const isSubjective = q?.type === 'Subjective' || q?.type === 'Numerical';
return {
question_id: a.question_id,
selected_answer: a.selected_answer,
is_correct: isCorrect,
is_correct: false,
is_subjective: isSubjective,
time_spent: a.time_spent
}
});