diff --git a/backend/competition/judge_views.py b/backend/competition/judge_views.py index f04ac5d..75b7537 100644 --- a/backend/competition/judge_views.py +++ b/backend/competition/judge_views.py @@ -449,7 +449,13 @@ def project_detail_api(request, project_id): 'peer_score': peer_score_avg, 'ai_score': ai_score_avg, 'final_score': final_score - } if role in ['judge', 'guest'] else None + } if role in ['judge', 'guest'] else None, + # 评分公式信息 + 'formula_info': { + 'name': project.competition.active_formula.name if project.competition.active_formula else None, + 'formula': project.competition.active_formula.formula if project.competition.active_formula else None, + 'preview': project.competition.active_formula.get_formula_preview() if project.competition.active_formula else None + } if project.competition.score_calculation_type == 'formula' else None } # Specifically for guest: can_grade is False diff --git a/backend/competition/models.py b/backend/competition/models.py index 6446b37..397666a 100644 --- a/backend/competition/models.py +++ b/backend/competition/models.py @@ -391,6 +391,7 @@ class ScoreFormula(models.Model): dimension_map = {f'd["{d.name}"]': f'[{d.name}]' for d in self.competition.score_dimensions.all()} dimension_map.update({f"d['{d.name}']": f'[{d.name}]' for d in self.competition.score_dimensions.all()}) + dimension_map.update({f'dimension_{d.id}': f'[{d.name}]' for d in self.competition.score_dimensions.all()}) result = self.formula for old, new in dimension_map.items(): diff --git a/backend/competition/templates/judge/dashboard.html b/backend/competition/templates/judge/dashboard.html index 1f46812..a6cbb68 100644 --- a/backend/competition/templates/judge/dashboard.html +++ b/backend/competition/templates/judge/dashboard.html @@ -183,6 +183,16 @@ -- + + +
+
+ + 评分算法 +
+
--
+
--
+
@@ -644,6 +654,16 @@ async function viewProject(id) { document.getElementById('peerScoreValue').innerText = data.score_details.peer_score !== null ? data.score_details.peer_score : '--'; document.getElementById('aiScoreValue').innerText = data.score_details.ai_score !== null ? data.score_details.ai_score : '--'; document.getElementById('finalScoreValue').innerText = data.score_details.final_score !== null ? data.score_details.final_score : '--'; + + // 渲染评分公式信息 + const formulaInfoSection = document.getElementById('formulaInfoSection'); + if (data.formula_info && data.formula_info.name) { + formulaInfoSection.style.display = 'block'; + document.getElementById('formulaName').innerText = data.formula_info.name; + document.getElementById('formulaPreview').innerText = data.formula_info.preview || data.formula_info.formula || '--'; + } else { + formulaInfoSection.style.display = 'none'; + } } else { scoreDetailsSection.style.display = 'none'; }