修正詳細評審頁面結果
This commit is contained in:
74
test-chart-data.js
Normal file
74
test-chart-data.js
Normal file
@@ -0,0 +1,74 @@
|
||||
const http = require('http');
|
||||
|
||||
function makeRequest(url) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const req = http.get(url, (res) => {
|
||||
let data = '';
|
||||
res.on('data', (chunk) => {
|
||||
data += chunk;
|
||||
});
|
||||
res.on('end', () => {
|
||||
try {
|
||||
const jsonData = JSON.parse(data);
|
||||
resolve(jsonData);
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
req.on('error', reject);
|
||||
});
|
||||
}
|
||||
|
||||
async function testChartData() {
|
||||
try {
|
||||
console.log('🧪 測試圖表數據生成...');
|
||||
|
||||
// 測試評審詳細API
|
||||
console.log('📋 測試評審詳細API (ID=2)...');
|
||||
const detailData = await makeRequest('http://localhost:3000/api/evaluation/2');
|
||||
|
||||
if (detailData.success) {
|
||||
console.log('✅ API 調用成功');
|
||||
console.log('📊 專案標題:', detailData.data.projectTitle);
|
||||
console.log('📊 總分:', detailData.data.overallScore);
|
||||
|
||||
// 檢查圖表數據
|
||||
console.log('\n📊 圖表數據檢查:');
|
||||
|
||||
console.log('\n📈 各項目得分 (Bar Chart):');
|
||||
detailData.data.chartData.barChart.forEach((item, index) => {
|
||||
console.log(` ${index + 1}. ${item.name}: ${item.score}分`);
|
||||
});
|
||||
|
||||
console.log('\n🥧 權重分布 (Pie Chart):');
|
||||
detailData.data.chartData.pieChart.forEach((item, index) => {
|
||||
console.log(` ${index + 1}. ${item.name}: 權重=${item.weight}%, 加權分數=${item.value}`);
|
||||
});
|
||||
|
||||
console.log('\n🎯 能力雷達圖 (Radar Chart):');
|
||||
detailData.data.chartData.radarChart.forEach((item, index) => {
|
||||
console.log(` ${index + 1}. ${item.subject}: ${item.score}/${item.fullMark}`);
|
||||
});
|
||||
|
||||
// 檢查評分標準詳情
|
||||
console.log('\n📝 評分標準詳情:');
|
||||
detailData.data.criteria.forEach((criteria, index) => {
|
||||
console.log(` ${index + 1}. ${criteria.name}: ${criteria.score}/${criteria.maxScore}`);
|
||||
console.log(` AI 評語: ${criteria.feedback}`);
|
||||
console.log(` 優點: ${criteria.strengths.length > 0 ? criteria.strengths.join(', ') : '無'}`);
|
||||
console.log(` 改進建議: ${criteria.improvements.length > 0 ? criteria.improvements.join(', ') : '無'}`);
|
||||
console.log('');
|
||||
});
|
||||
|
||||
} else {
|
||||
console.log('❌ API 調用失敗:', detailData.error);
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ 測試失敗:', error.message);
|
||||
}
|
||||
}
|
||||
|
||||
// 等待一下讓服務器啟動
|
||||
setTimeout(testChartData, 2000);
|
Reference in New Issue
Block a user