修正評分詳細沒有上傳問題
This commit is contained in:
@@ -195,11 +195,20 @@ export function ScoringManagement() {
|
||||
rules.forEach((rule: any) => {
|
||||
const score = scores[rule.name] || 0
|
||||
const weight = parseFloat(rule.weight) || 1
|
||||
totalScore += score * weight
|
||||
totalWeight += weight
|
||||
if (score > 0) {
|
||||
totalScore += score * (weight / 100)
|
||||
totalWeight += weight
|
||||
}
|
||||
})
|
||||
|
||||
return totalWeight > 0 ? totalScore / totalWeight : 0
|
||||
// 如果總權重為0,使用平均分
|
||||
if (totalWeight === 0) {
|
||||
const validScores = Object.values(scores).filter(score => score > 0)
|
||||
totalScore = validScores.length > 0 ? validScores.reduce((sum, score) => sum + score, 0) / validScores.length : 0
|
||||
}
|
||||
|
||||
// 轉換為100分制(10分制 * 10 = 100分制)
|
||||
return totalScore
|
||||
}
|
||||
|
||||
// 生成所有評審和APP的組合
|
||||
@@ -408,7 +417,7 @@ export function ScoringManagement() {
|
||||
participantName: competitionParticipants.find(p => p.id === manualScoring.participantId)?.displayName || competitionParticipants.find(p => p.id === manualScoring.participantId)?.name || '未知參賽者',
|
||||
participantType: competitionParticipants.find(p => p.id === manualScoring.participantId)?.type as "individual" | "team" || "individual",
|
||||
scores: apiScores,
|
||||
totalScore: calculateTotalScore(apiScores, rules),
|
||||
totalScore: data.data?.total_score || calculateTotalScore(apiScores, rules),
|
||||
comments: manualScoring.comments.trim(),
|
||||
status: "completed",
|
||||
submittedAt: new Date().toISOString()
|
||||
|
Reference in New Issue
Block a user