This commit is contained in:
@@ -449,7 +449,13 @@ def project_detail_api(request, project_id):
|
|||||||
'peer_score': peer_score_avg,
|
'peer_score': peer_score_avg,
|
||||||
'ai_score': ai_score_avg,
|
'ai_score': ai_score_avg,
|
||||||
'final_score': final_score
|
'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
|
# Specifically for guest: can_grade is False
|
||||||
|
|||||||
@@ -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 = {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"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
|
result = self.formula
|
||||||
for old, new in dimension_map.items():
|
for old, new in dimension_map.items():
|
||||||
|
|||||||
@@ -183,6 +183,16 @@
|
|||||||
<span id="finalScoreValue" class="text-2xl font-bold text-yellow-600">--</span>
|
<span id="finalScoreValue" class="text-2xl font-bold text-yellow-600">--</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 评分公式信息 -->
|
||||||
|
<div id="formulaInfoSection" class="mt-4 p-4 bg-gradient-to-r from-indigo-50 to-purple-50 rounded-lg border border-indigo-200">
|
||||||
|
<div class="flex items-center mb-2">
|
||||||
|
<i class="fas fa-calculator text-indigo-500 mr-2"></i>
|
||||||
|
<span class="text-sm font-bold text-indigo-700">评分算法</span>
|
||||||
|
</div>
|
||||||
|
<div id="formulaName" class="text-sm font-semibold text-gray-800 mb-1">--</div>
|
||||||
|
<div id="formulaPreview" class="text-xs text-gray-600 bg-white p-2 rounded border border-indigo-100 font-mono break-all">--</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -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('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('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 : '--';
|
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 {
|
} else {
|
||||||
scoreDetailsSection.style.display = 'none';
|
scoreDetailsSection.style.display = 'none';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user