fix(dashboard): DPP tags properly dynamic based on user target exam
This commit is contained in:
@@ -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
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user