diff --git a/backend/competition/models.py b/backend/competition/models.py index 160d8db..2112ac1 100644 --- a/backend/competition/models.py +++ b/backend/competition/models.py @@ -149,10 +149,8 @@ class Project(models.Model): 计算项目得分 计算公式: 1. 获取所有评委对该项目的打分 - 2. 按维度加权平均 - 这里简化处理: - 总分 = (所有评委的总加权分之和) / 评委人数 - 其中每个评委对项目的打分 = sum(维度分 * 维度权重) + 2. 每个评委的得分 = sum(维度分数 × 维度权重) + 3. 项目最终得分 = 所有评委得分的平均值 """ # 获取所有评分 scores = self.scores.all() @@ -171,19 +169,12 @@ class Project(models.Model): # 获取该评委对该项目的所有维度打分 judge_scores = scores.filter(judge=judge) - current_judge_total_score = 0 - current_judge_total_weight = 0 - for score in judge_scores: - current_judge_total_score += score.score * score.dimension.weight - current_judge_total_weight += score.dimension.weight - - if current_judge_total_weight > 0: - judge_score = current_judge_total_score / current_judge_total_weight - # 如果是百分制,这里算出来就是0-100 + # 直接用原始分数乘以权重相加 + judge_score += score.score * score.dimension.weight total_weighted_score += judge_score - + # 平均分 avg_score = total_weighted_score / len(judges) self.final_score = avg_score diff --git a/backend/competition/templates/judge/dashboard.html b/backend/competition/templates/judge/dashboard.html index 5021850..9841940 100644 --- a/backend/competition/templates/judge/dashboard.html +++ b/backend/competition/templates/judge/dashboard.html @@ -161,6 +161,14 @@ +
+
+ 综合得分 + 0 +
+

各维度分数×权重相加,提交后计算所有评委平均值

+
+