This commit is contained in:
@@ -432,6 +432,9 @@ def project_detail_api(request, project_id):
|
|||||||
if ai_count > 0:
|
if ai_count > 0:
|
||||||
ai_score_avg = round(ai_total / ai_count, 2)
|
ai_score_avg = round(ai_total / ai_count, 2)
|
||||||
|
|
||||||
|
# 判断是否为选手查看自己的项目
|
||||||
|
is_own_project = role == 'contestant' and project.contestant.user == user
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
'id': project.id,
|
'id': project.id,
|
||||||
'title': project.title,
|
'title': project.title,
|
||||||
@@ -443,19 +446,20 @@ def project_detail_api(request, project_id):
|
|||||||
'ai_result': ai_data,
|
'ai_result': ai_data,
|
||||||
'audio_url': audio_url,
|
'audio_url': audio_url,
|
||||||
'can_grade': role == 'judge' or (role == 'contestant' and project.contestant.user != user),
|
'can_grade': role == 'judge' or (role == 'contestant' and project.contestant.user != user),
|
||||||
# 评分细项(仅评委和嘉宾可见)
|
'is_own_project': is_own_project,
|
||||||
|
# 评分细项(评委、嘉宾可见,选手查看自己的项目时也可见)
|
||||||
'score_details': {
|
'score_details': {
|
||||||
'judge_score': judge_score_avg,
|
'judge_score': judge_score_avg,
|
||||||
'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'] or is_own_project else None,
|
||||||
# 评分公式信息
|
# 评分公式信息(评委、嘉宾可见,选手查看自己的项目时也可见)
|
||||||
'formula_info': {
|
'formula_info': {
|
||||||
'name': project.competition.active_formula.name if project.competition.active_formula else None,
|
'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,
|
'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
|
'preview': project.competition.active_formula.get_formula_preview() if project.competition.active_formula else None
|
||||||
} if project.competition.score_calculation_type == 'formula' else None
|
} if project.competition.score_calculation_type == 'formula' and (role in ['judge', 'guest'] or is_own_project) else None
|
||||||
}
|
}
|
||||||
|
|
||||||
# Specifically for guest: can_grade is False
|
# Specifically for guest: can_grade is False
|
||||||
|
|||||||
@@ -177,7 +177,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="bg-white rounded-lg p-3 border border-gray-100 shadow-sm">
|
<div class="bg-white rounded-lg p-3 border border-gray-100 shadow-sm">
|
||||||
<div class="flex items-center justify-between mb-1">
|
<div class="flex items-center justify-between mb-1">
|
||||||
<span class="text-xs font-semibold text-gray-500 uppercase">最终平均分</span>
|
<span class="text-xs font-semibold text-gray-500 uppercase">最终总分</span>
|
||||||
<i class="fas fa-star text-yellow-400 text-sm"></i>
|
<i class="fas fa-star text-yellow-400 text-sm"></i>
|
||||||
</div>
|
</div>
|
||||||
<span id="finalScoreValue" class="text-2xl font-bold text-yellow-600">--</span>
|
<span id="finalScoreValue" class="text-2xl font-bold text-yellow-600">--</span>
|
||||||
@@ -701,6 +701,20 @@ async function viewProject(id) {
|
|||||||
if (!readOnlyMsg) {
|
if (!readOnlyMsg) {
|
||||||
readOnlyMsg = document.createElement('div');
|
readOnlyMsg = document.createElement('div');
|
||||||
readOnlyMsg.id = 'readOnlyMsg';
|
readOnlyMsg.id = 'readOnlyMsg';
|
||||||
|
readOnlyMsg.className = 'text-center py-10 bg-white rounded-lg border border-dashed border-gray-300 mt-4';
|
||||||
|
gradingContainer.appendChild(readOnlyMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.is_own_project) {
|
||||||
|
readOnlyMsg.className = 'text-center py-10 bg-white rounded-lg border border-dashed border-blue-300 mt-4';
|
||||||
|
readOnlyMsg.innerHTML = `
|
||||||
|
<div class="mx-auto h-12 w-12 bg-blue-50 rounded-full flex items-center justify-center mb-3">
|
||||||
|
<i class="fas fa-info-circle text-2xl text-blue-400"></i>
|
||||||
|
</div>
|
||||||
|
<h3 class="text-base font-medium text-gray-900">查看自己的项目</h3>
|
||||||
|
<p class="mt-1 text-sm text-gray-500">无法对自己的项目进行评分,但可以查看详细评分</p>
|
||||||
|
`;
|
||||||
|
} else {
|
||||||
readOnlyMsg.className = 'text-center py-10 bg-white rounded-lg border border-dashed border-gray-300 mt-4';
|
readOnlyMsg.className = 'text-center py-10 bg-white rounded-lg border border-dashed border-gray-300 mt-4';
|
||||||
readOnlyMsg.innerHTML = `
|
readOnlyMsg.innerHTML = `
|
||||||
<div class="mx-auto h-12 w-12 bg-gray-50 rounded-full flex items-center justify-center mb-3">
|
<div class="mx-auto h-12 w-12 bg-gray-50 rounded-full flex items-center justify-center mb-3">
|
||||||
@@ -709,7 +723,6 @@ async function viewProject(id) {
|
|||||||
<h3 class="text-base font-medium text-gray-900">仅浏览模式</h3>
|
<h3 class="text-base font-medium text-gray-900">仅浏览模式</h3>
|
||||||
<p class="mt-1 text-sm text-gray-500">当前身份无法进行评分</p>
|
<p class="mt-1 text-sm text-gray-500">当前身份无法进行评分</p>
|
||||||
`;
|
`;
|
||||||
gradingContainer.appendChild(readOnlyMsg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.can_grade) {
|
if (data.can_grade) {
|
||||||
|
|||||||
Reference in New Issue
Block a user