From d7fc1edd85a001001c7e0391a4e9451bdd60799f Mon Sep 17 00:00:00 2001 From: darkclip Date: Sun, 31 May 2026 00:39:18 +0800 Subject: [PATCH] update --- main.py | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/main.py b/main.py index d522ff7..873a190 100644 --- a/main.py +++ b/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( """ for judge in judges: s = scores_data.get(judge['name'], {}) - html += f"""""" + html += f"""""" html += f"""
评委姓名总分(100分)评委点评
{judge['name']}{s.get('total') if s.get('total', 0) > 0 else '-'}{s.get('comment', '')}
{judge['name']}{s.get('total') if s.get('total') is not None else '-'}{s.get('comment', '')}

评委组签名:____________________

日期:{datetime.now().strftime('%Y年%m月%d日')}

""" return html @@ -2034,8 +2023,8 @@ HTML_TEMPLATE = """ row.insertCell(5).innerText = item.category; let avgDisplay = item.avg_score === null ? '-' : `${item.avg_score}`; 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';