From 40562c1bbd7ae49b842d9132466fb67f91210e92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B3=E4=BD=A9=E5=BA=AD?= Date: Sat, 4 Oct 2025 21:23:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=AE=8C=E6=95=B4=E7=9A=84?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E8=80=85=E6=9F=A5=E7=9C=8B=E8=A9=B3=E7=B4=B0?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../results/detail/[testResultId]/page.tsx | 188 +++++++++++------- components/combined-analysis.tsx | 143 ++++++++++++- components/individual-test-results.tsx | 163 +++++++++++++++ 3 files changed, 415 insertions(+), 79 deletions(-) create mode 100644 components/individual-test-results.tsx diff --git a/app/admin/results/detail/[testResultId]/page.tsx b/app/admin/results/detail/[testResultId]/page.tsx index 5b87167..4b38acb 100644 --- a/app/admin/results/detail/[testResultId]/page.tsx +++ b/app/admin/results/detail/[testResultId]/page.tsx @@ -55,6 +55,7 @@ interface Question { userAnswer?: string | number isCorrect?: boolean score?: number + category?: 'innovation' | 'imagination' | 'flexibility' | 'originality' created_at: string } @@ -394,82 +395,94 @@ function AdminResultDetailContent() { - {/* Score Overview */} - - -
- {result.score} -
- 測試完成! -
- - {scoreLevel.level} - -
-

{scoreLevel.description}

-
-

- 👉 建議: - {scoreLevel.suggestion} -

-
-
- -
- {result.type === 'creative' ? ( - <> -
-
{displayTotalScore}
-
總得分
+ {/* Logic Test Overview */} + {result.type === 'logic' && ( + + +
+ {result.score} +
+ 邏輯測試完成! +
+ + {scoreLevel.level} + +
+

{scoreLevel.description}

+
+

+ 👉 建議: + {scoreLevel.suggestion} +

+
+
+ +
+
+
{correctAnswers}
+
答對題數
+
+
+
{totalQuestions}
+
總題數
+
+
+
+ {totalQuestions > 0 ? Math.round((correctAnswers / totalQuestions) * 100) : 0}%
-
-
{displayMaxScore}
-
滿分
-
-
-
- {displayScorePercentage}% -
-
得分率
-
- - ) : ( - <> -
-
{correctAnswers}
-
答對題數
-
-
-
{totalQuestions}
-
總題數
-
-
-
- {totalQuestions > 0 ? Math.round((correctAnswers / totalQuestions) * 100) : 0}% -
-
正確率
-
- - )} -
- - - +
正確率
+
+
+ + + + )} - {/* Combined Test Analysis */} - {result.type === 'combined' && result.details && ( - + {/* Creative Test Overview */} + {result.type === 'creative' && ( + + +
+ {result.score} +
+ 創意測試完成! +
+ + {scoreLevel.level} + +
+

{scoreLevel.description}

+
+

+ 👉 建議: + {scoreLevel.suggestion} +

+
+
+ +
+
+
{displayTotalScore}
+
總得分
+
+
+
{displayMaxScore}
+
滿分
+
+
+
+ {displayScorePercentage}% +
+
得分率
+
+
+ +
+
)} {/* Creative Analysis for Creative Tests */} @@ -483,6 +496,31 @@ function AdminResultDetailContent() { /> )} + {/* Combined Test Analysis */} + {result.type === 'combined' && result.details && ( + q.isCorrect).length} + logicTotalQuestions={logicQuestions.length} + logicLevel={getScoreLevel(result.details.logicScore || 0, 'logic').level} + logicDescription={getScoreLevel(result.details.logicScore || 0, 'logic').description} + logicSuggestion={getScoreLevel(result.details.logicScore || 0, 'logic').suggestion} + creativityTotalScore={creativeQuestions.reduce((sum, q) => sum + (q.score || 0), 0)} + creativityMaxScore={creativeQuestions.length * 5} + creativityLevel={getScoreLevel(result.details.creativeScore || 0, 'creative').level} + creativityDescription={getScoreLevel(result.details.creativeScore || 0, 'creative').description} + creativitySuggestion={getScoreLevel(result.details.creativeScore || 0, 'creative').suggestion} + /> + )} + {/* Detailed Results */} {questions.length > 0 && ( @@ -571,7 +609,7 @@ function AdminResultDetailContent() {
{creativeQuestions.map((question, index) => { - const dimensionInfo = getDimensionInfo(question.category) + const dimensionInfo = getDimensionInfo(question.category || 'innovation') return (
diff --git a/components/combined-analysis.tsx b/components/combined-analysis.tsx index 9760596..fea67ba 100644 --- a/components/combined-analysis.tsx +++ b/components/combined-analysis.tsx @@ -14,6 +14,17 @@ interface CombinedAnalysisProps { description: string logicBreakdown?: any creativityBreakdown?: any + // 個別測試結果的詳細資料 + logicCorrectAnswers?: number + logicTotalQuestions?: number + logicLevel?: string + logicDescription?: string + logicSuggestion?: string + creativityTotalScore?: number + creativityMaxScore?: number + creativityLevel?: string + creativityDescription?: string + creativitySuggestion?: string } export function CombinedAnalysis({ @@ -24,7 +35,18 @@ export function CombinedAnalysis({ level, description, logicBreakdown, - creativityBreakdown + creativityBreakdown, + // 個別測試結果的詳細資料 + logicCorrectAnswers, + logicTotalQuestions, + logicLevel, + logicDescription, + logicSuggestion, + creativityTotalScore, + creativityMaxScore, + creativityLevel, + creativityDescription, + creativitySuggestion }: CombinedAnalysisProps) { // 獲取等級顏色 @@ -111,6 +133,119 @@ export function CombinedAnalysis({ + {/* 個別測試結果 */} + {(logicCorrectAnswers !== undefined || creativityTotalScore !== undefined) && ( +
+ {/* 邏輯思維測試 */} + {logicCorrectAnswers !== undefined && ( + + + + + 邏輯思維測試 + + + +
+ {/* 分數顯示 */} +
+ 得分 +
+ + {logicScore} +
+
+ + {/* 統計數據 */} +
+
+
{logicCorrectAnswers}
+
答對題數
+
+
+
{logicTotalQuestions}
+
總題數
+
+
+ + {/* 等級和描述 */} +
+
+
+ {logicLevel} +
+

+ {logicDescription} +

+
+ +
+ 建議: +

{logicSuggestion}

+
+
+
+
+
+
+ )} + + {/* 創意能力測試 */} + {creativityTotalScore !== undefined && ( + + + + + 創意能力測試 + + + +
+ {/* 分數顯示 */} +
+ 得分 +
+ + {creativityScore} +
+
+ + {/* 統計數據 */} +
+
+
{creativityTotalScore}
+
原始得分
+
+
+
{creativityMaxScore}
+
滿分
+
+
+ + {/* 等級和描述 */} +
+
+
+ {creativityLevel} +
+

+ {creativityDescription} +

+
+ +
+ 建議: +

{creativitySuggestion}

+
+
+
+
+
+
+ )} +
+ )} + {/* 能力分析 */} @@ -127,7 +262,7 @@ export function CombinedAnalysis({

邏輯思維

-
{logicScore}分
+
{logicScore}
{logicStatus.text}
@@ -138,7 +273,7 @@ export function CombinedAnalysis({

創意能力

-
{creativityScore}分
+
{creativityScore}
{creativityStatus.text}
@@ -149,7 +284,7 @@ export function CombinedAnalysis({

能力平衡

-
{balanceScore}分
+
{balanceScore}
{balanceStatus.text}
diff --git a/components/individual-test-results.tsx b/components/individual-test-results.tsx new file mode 100644 index 0000000..add469f --- /dev/null +++ b/components/individual-test-results.tsx @@ -0,0 +1,163 @@ +"use client" + +import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" +import { Badge } from "@/components/ui/badge" +import { Progress } from "@/components/ui/progress" +import { Brain, Lightbulb, CheckCircle, Star } from "lucide-react" + +interface IndividualTestResultsProps { + logicScore: number + logicCorrectAnswers: number + logicTotalQuestions: number + logicLevel: string + logicDescription: string + logicSuggestion: string + creativityScore: number + creativityTotalScore: number + creativityMaxScore: number + creativityLevel: string + creativityDescription: string + creativitySuggestion: string +} + +export function IndividualTestResults({ + logicScore, + logicCorrectAnswers, + logicTotalQuestions, + logicLevel, + logicDescription, + logicSuggestion, + creativityScore, + creativityTotalScore, + creativityMaxScore, + creativityLevel, + creativityDescription, + creativitySuggestion +}: IndividualTestResultsProps) { + + // 獲取邏輯測試等級顏色 + const getLogicLevelColor = (score: number) => { + if (score >= 90) return "bg-purple-600" + if (score >= 80) return "bg-green-500" + if (score >= 60) return "bg-blue-500" + if (score >= 30) return "bg-yellow-500" + return "bg-red-500" + } + + // 獲取創意測試等級顏色 + const getCreativityLevelColor = (score: number) => { + if (score >= 90) return "bg-purple-600" + if (score >= 75) return "bg-blue-500" + if (score >= 55) return "bg-green-500" + if (score >= 35) return "bg-yellow-500" + return "bg-red-500" + } + + return ( +
+ {/* 邏輯思維測試 */} + + + + + 邏輯思維測試 + + + +
+ {/* 分數顯示 */} +
+ 得分 +
+ + {logicScore} +
+
+ + {/* 統計數據 */} +
+
+
{logicCorrectAnswers}
+
答對題數
+
+
+
{logicTotalQuestions}
+
總題數
+
+
+ + {/* 等級和描述 */} +
+
+
+ {logicLevel} +
+

+ {logicDescription} +

+
+ +
+ 建議: +

{logicSuggestion}

+
+
+
+
+
+
+ + {/* 創意能力測試 */} + + + + + 創意能力測試 + + + +
+ {/* 分數顯示 */} +
+ 得分 +
+ + {creativityScore} +
+
+ + {/* 統計數據 */} +
+
+
{creativityTotalScore}
+
原始得分
+
+
+
{creativityMaxScore}
+
滿分
+
+
+ + {/* 等級和描述 */} +
+
+
+ {creativityLevel} +
+

+ {creativityDescription} +

+
+ +
+ 建議: +

{creativitySuggestion}

+
+
+
+
+
+
+
+ ) +}