feat: 完善中文心理测评平台

This commit is contained in:
mikemoi
2026-06-22 22:59:01 +02:00
commit 9227c687fc
160 changed files with 16974 additions and 0 deletions
@@ -0,0 +1,29 @@
const correctAnswers: Record<number, string> = {
1: 'B',
2: 'A',
3: 'B',
4: 'A',
5: 'B',
6: 'B',
7: 'B',
};
export function calculateCRTResults(answers: string[]) {
const items = answers.map((answer, index) => {
const questionId = index + 1;
return {
questionId,
selected: answer,
correct: correctAnswers[questionId],
isCorrect: answer === correctAnswers[questionId],
};
});
const score = items.filter((item) => item.isCorrect).length;
return {
score,
total: Object.keys(correctAnswers).length,
items,
};
}