修正詳細評審頁面結果

This commit is contained in:
2025-09-23 22:46:01 +08:00
parent d94b1786d6
commit f018e71577
10 changed files with 558 additions and 24 deletions

66
check-feedback-data.js Normal file
View File

@@ -0,0 +1,66 @@
const mysql = require('mysql2/promise');
const dbConfig = {
host: 'mysql.theaken.com',
port: 33306,
user: 'root',
password: 'zh6161168',
database: 'db_AI_scoring'
};
async function checkFeedbackData() {
let connection;
try {
console.log('🔗 連接到資料庫...');
connection = await mysql.createConnection(dbConfig);
console.log('✅ 資料庫連接成功');
// 檢查 evaluation_feedback 表結構
console.log('📋 檢查 evaluation_feedback 表結構...');
const [columns] = await connection.execute(`
SELECT COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_DEFAULT
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'evaluation_feedback'
ORDER BY ORDINAL_POSITION
`);
console.log('表結構:', columns);
// 檢查 evaluation_feedback 數據
console.log('📊 檢查 evaluation_feedback 數據...');
const [feedbackData] = await connection.execute(`
SELECT id, evaluation_id, criteria_item_id, feedback_type, content, sort_order
FROM evaluation_feedback
WHERE evaluation_id = 2
ORDER BY sort_order
`);
console.log('評審 ID 2 的反饋數據:', feedbackData);
// 檢查不同 feedback_type 的數據
console.log('🔍 檢查不同 feedback_type 的數據...');
const [typeStats] = await connection.execute(`
SELECT feedback_type, COUNT(*) as count
FROM evaluation_feedback
GROUP BY feedback_type
`);
console.log('feedback_type 統計:', typeStats);
// 檢查 criteria_items 表
console.log('📝 檢查 criteria_items 表...');
const [criteriaItems] = await connection.execute(`
SELECT id, name, description
FROM criteria_items
ORDER BY id
`);
console.log('評分標準項目:', criteriaItems);
} catch (error) {
console.error('❌ 錯誤:', error.message);
} finally {
if (connection) {
await connection.end();
console.log('🔌 資料庫連接已關閉');
}
}
}
checkFeedbackData();