修正綜合題 bug

This commit is contained in:
2025-09-29 21:10:14 +08:00
parent 5a8cc7ec18
commit 426deafbb8

View File

@@ -176,9 +176,12 @@ export default function CombinedTestPage() {
// Calculate creativity score // Calculate creativity score
let creativityTotal = 0 let creativityTotal = 0
const processedCreativeAnswers: Record<number, number> = {}
creativeQuestions.forEach((question, index) => { creativeQuestions.forEach((question, index) => {
const answer = creativeAnswers[index] || 1 const answer = creativeAnswers[index] || 1
creativityTotal += question.is_reverse ? 6 - answer : answer const processedScore = question.is_reverse ? 6 - answer : answer
creativityTotal += processedScore
processedCreativeAnswers[index] = processedScore
}) })
const creativityMaxScore = creativeQuestions.length * 5 const creativityMaxScore = creativeQuestions.length * 5
const creativityScore = Math.round((creativityTotal / creativityMaxScore) * 100) const creativityScore = Math.round((creativityTotal / creativityMaxScore) * 100)
@@ -196,7 +199,7 @@ export default function CombinedTestPage() {
description: combinedResult.description, description: combinedResult.description,
breakdown: combinedResult.breakdown, breakdown: combinedResult.breakdown,
logicAnswers, logicAnswers,
creativeAnswers, creativeAnswers: processedCreativeAnswers,
logicCorrect, logicCorrect,
creativityTotal, creativityTotal,
creativityMaxScore, creativityMaxScore,
@@ -223,7 +226,7 @@ export default function CombinedTestPage() {
creativityBreakdown: { creativityBreakdown: {
total: creativityTotal, total: creativityTotal,
maxScore: creativityMaxScore, maxScore: creativityMaxScore,
answers: creativeAnswers answers: processedCreativeAnswers
}, },
balanceScore: combinedResult.breakdown.balance, balanceScore: combinedResult.breakdown.balance,
completedAt: new Date().toISOString() completedAt: new Date().toISOString()