修改測驗時間、新增測驗提醒、新增截止測驗功能

This commit is contained in:
2025-10-12 00:18:24 +08:00
parent 967541a492
commit cf40e937a1
7 changed files with 176 additions and 19 deletions

View File

@@ -13,6 +13,7 @@ export interface CombinedTestResult {
creativity_breakdown: any | null // JSON 格式
balance_score: number
completed_at: string
is_timeout: boolean
created_at?: string
}
@@ -27,6 +28,7 @@ export interface CreateCombinedTestResultData {
creativity_breakdown: any | null
balance_score: number
completed_at: string
is_timeout: boolean
}
// 建立綜合測試結果表(如果不存在)
@@ -44,6 +46,7 @@ export async function createCombinedTestResultsTable(): Promise<void> {
creativity_breakdown JSON NULL,
balance_score INT NOT NULL,
completed_at TIMESTAMP NOT NULL,
is_timeout BOOLEAN DEFAULT FALSE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
INDEX idx_user_id (user_id),
INDEX idx_completed_at (completed_at)
@@ -62,8 +65,8 @@ export async function createCombinedTestResult(resultData: CreateCombinedTestRes
INSERT INTO combined_test_results (
id, user_id, logic_score, creativity_score, overall_score,
level, description, logic_breakdown, creativity_breakdown,
balance_score, completed_at
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
balance_score, completed_at, is_timeout
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
`
const values = [
@@ -77,7 +80,8 @@ export async function createCombinedTestResult(resultData: CreateCombinedTestRes
resultData.logic_breakdown ? JSON.stringify(resultData.logic_breakdown) : null,
resultData.creativity_breakdown ? JSON.stringify(resultData.creativity_breakdown) : null,
resultData.balance_score,
resultData.completed_at
resultData.completed_at,
resultData.is_timeout
]
try {