diff --git a/DATABASE_SETUP.md b/DATABASE_SETUP.md index 0bd8579..a34d668 100644 --- a/DATABASE_SETUP.md +++ b/DATABASE_SETUP.md @@ -65,8 +65,7 @@ pnpm install | option_b | VARCHAR(500) | 選項 B | | option_c | VARCHAR(500) | 選項 C | | option_d | VARCHAR(500) | 選項 D | -| option_e | VARCHAR(500) | 選項 E | -| correct_answer | ENUM('A', 'B', 'C', 'D', 'E') | 正確答案 | +| correct_answer | ENUM('A', 'B', 'C', 'D') | 正確答案 | | explanation | TEXT | 解說 | | created_at | TIMESTAMP | 建立時間 | @@ -89,8 +88,6 @@ npx tsx lib/database/seed.ts - `npm run test-db` - 測試資料庫連接 - `npm run check-passwords` - 檢查密碼雜湊狀態 - `npm run check-logic-questions` - 檢查邏輯思維題目 -- `npm run test-logic-flow` - 測試邏輯思維測試完整流程 -- `npm run update-logic-table` - 更新邏輯思維題目表結構(加入 E 選項) - `npm run reset-users` - 重新建立用戶數據(使用雜湊密碼) - `npm run seed-logic-questions` - 上傳邏輯思維題目到資料庫 - `npm run test-login` - 測試登入功能(需要先啟動開發伺服器) diff --git a/app/results/logic/page.tsx b/app/results/logic/page.tsx index 06de7ae..96cf6d0 100644 --- a/app/results/logic/page.tsx +++ b/app/results/logic/page.tsx @@ -44,15 +44,17 @@ export default function LogicResultsPage() { setResults(JSON.parse(savedResults)) } - // 載入題目數據 + // 載入題目資料 const response = await fetch('/api/logic-questions') const data = await response.json() if (data.success) { setQuestions(data.questions) + } else { + console.error('Failed to load questions:', data.error) } } catch (error) { - console.error('載入數據失敗:', error) + console.error('Error loading data:', error) } finally { setIsLoading(false) } @@ -90,37 +92,29 @@ export default function LogicResultsPage() { } const getScoreLevel = (score: number) => { - if (score === 100) { - return { - level: "邏輯巔峰者", - color: "bg-purple-600", - description: "近乎完美的邏輯典範!你像一台「推理引擎」,嚴謹又高效,幾乎不受陷阱干擾。", - suggestion: "多和他人分享你的思考路徑,能幫助團隊整體邏輯力提升。" - } + if (score === 100) return { + level: "邏輯巔峰者", + color: "bg-purple-600", + description: "近乎完美的邏輯典範!你像一台「推理引擎」,嚴謹又高效,幾乎不受陷阱干擾。", + suggestion: "多和他人分享你的思考路徑,能幫助團隊整體邏輯力提升。" } - if (score >= 80) { - return { - level: "邏輯大師", - color: "bg-green-600", - description: "你的思維如同精密儀器,能快速抓住題目關鍵,並做出有效推理。常常是團隊中「冷靜的分析者」。", - suggestion: "挑戰更高層次的難題,讓你的邏輯力更加精進。" - } + if (score >= 80) return { + level: "邏輯大師", + color: "bg-green-500", + description: "你的思維如同精密儀器,能快速抓住題目關鍵,並做出有效推理。常常是團隊中「冷靜的分析者」。", + suggestion: "挑戰更高層次的難題,讓你的邏輯力更加精進。" } - if (score >= 60) { - return { - level: "邏輯高手", - color: "bg-blue-500", - description: "邏輯清晰穩定,大部分情境都能正確判斷。偶爾會因粗心錯過陷阱。", - suggestion: "在思維縝密之餘,更加留心細節,就能把錯誤率降到最低。" - } + if (score >= 60) return { + level: "邏輯高手", + color: "bg-blue-500", + description: "邏輯清晰穩定,大部分情境都能正確判斷。偶爾會因粗心錯過陷阱。", + suggestion: "在思維縝密之餘,更加留心細節,就能把錯誤率降到最低。" } - if (score >= 30) { - return { - level: "邏輯學徒", - color: "bg-yellow-500", - description: "已經抓到一些邏輯規律,能解決中等難度的問題。遇到複雜情境時,仍可能卡關。", - suggestion: "嘗試將問題拆解成小步驟,就像組裝樂高,每一塊拼好,答案就自然浮現。" - } + if (score >= 30) return { + level: "邏輯學徒", + color: "bg-yellow-500", + description: "已經抓到一些邏輯規律,能解決中等難度的問題。遇到複雜情境時,仍可能卡關。", + suggestion: "嘗試將問題拆解成小步驟,就像組裝樂高,每一塊拼好,答案就自然浮現。" } return { level: "邏輯探險新手", @@ -167,11 +161,7 @@ export default function LogicResultsPage() { {scoreLevel.level} -
{scoreLevel.description}
-💡 建議:
-{scoreLevel.suggestion}
-{scoreLevel.description}