update
This commit is contained in:
parent
793eff3fd6
commit
d7fc1edd85
23
main.py
23
main.py
@ -796,7 +796,6 @@ async def update_score(judge_id: str, score_data: ScoreDetailUpdate):
|
||||
ON CONFLICT(judge_id, program_sn) DO UPDATE SET
|
||||
{field_map[score_data.field]} = excluded.{field_map[score_data.field]},
|
||||
updated_at = excluded.updated_at,
|
||||
admin_total_score = NULL
|
||||
""",
|
||||
(judge_id, score_data.program_sn, val, datetime.now()),
|
||||
)
|
||||
@ -863,20 +862,10 @@ async def batch_update_scores(batch_data: ScoreBatchUpdate):
|
||||
INSERT INTO scores (judge_id, program_sn, admin_total_score, updated_at)
|
||||
VALUES (?, ?, ?, ?)
|
||||
ON CONFLICT(judge_id, program_sn) DO UPDATE SET
|
||||
content_score = NULL,
|
||||
stage_score = NULL,
|
||||
art_score = NULL,
|
||||
overall_score = NULL,
|
||||
admin_total_score = excluded.admin_total_score,
|
||||
comment = NULL,
|
||||
updated_at = excluded.updated_at
|
||||
""",
|
||||
(
|
||||
judge_id,
|
||||
batch_data.program_sn,
|
||||
total_score,
|
||||
datetime.now(),
|
||||
),
|
||||
(judge_id, batch_data.program_sn, total_score, datetime.now()),
|
||||
)
|
||||
return {'success': True}
|
||||
|
||||
@ -974,8 +963,8 @@ async def get_aggregate(batch_id: int | None = Query(None)):
|
||||
for row in cursor.fetchall():
|
||||
stats[row['program_sn']] = {
|
||||
'avg_score': row['avg_score'] if row['avg_score'] is not None else None,
|
||||
'max_score': row['max_score'] or 0,
|
||||
'min_score': row['min_score'] or 0,
|
||||
'max_score': row['max_score'],
|
||||
'min_score': row['min_score'],
|
||||
'scored_count': row['scored_count'] or 0,
|
||||
}
|
||||
|
||||
@ -1194,7 +1183,7 @@ def render_print_program_template(
|
||||
<table><thead><tr><th>评委姓名</th><th>总分(100分)</th><th>评委点评</th></tr></thead><tbody>"""
|
||||
for judge in judges:
|
||||
s = scores_data.get(judge['name'], {})
|
||||
html += f"""<tr><td style="font-weight:bold;">{judge['name']}</td><td class="total">{s.get('total') if s.get('total', 0) > 0 else '-'}</td><td class="comment-cell">{s.get('comment', '')}</td></tr>"""
|
||||
html += f"""<tr><td style="font-weight:bold;">{judge['name']}</td><td class="total">{s.get('total') if s.get('total') is not None else '-'}</td><td class="comment-cell">{s.get('comment', '')}</td></tr>"""
|
||||
html += f"""</tbody></table><div style="margin-top: 30px;"><p>评委组签名:____________________</p><p style="text-align: right;">日期:{datetime.now().strftime('%Y年%m月%d日')}</p></div>
|
||||
<div class="no-print" style="margin-top: 30px; text-align: center;"><button onclick="window.print()">🖨️ 打印本页</button> <button onclick="window.close()">关闭</button></div></div></body></html>"""
|
||||
return html
|
||||
@ -2034,8 +2023,8 @@ HTML_TEMPLATE = """
|
||||
row.insertCell(5).innerText = item.category;
|
||||
let avgDisplay = item.avg_score === null ? '-' : `<strong>${item.avg_score}</strong>`;
|
||||
row.insertCell(6).innerHTML = avgDisplay;
|
||||
row.insertCell(7).innerText = item.max_score;
|
||||
row.insertCell(8).innerText = item.min_score;
|
||||
row.insertCell(7).innerText = item.max_score ?? '-';
|
||||
row.insertCell(8).innerText = item.min_score ?? '-';
|
||||
row.insertCell(9).innerText = item.scored_count;
|
||||
const btnCell = row.insertCell(10);
|
||||
btnCell.className = 'col-operation';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user