From 4ad1cd401817562e20a9b0011940232b56821999 Mon Sep 17 00:00:00 2001
From: Martin Mares <mj@ucw.cz>
Date: Tue, 30 Nov 2021 14:08:19 +0100
Subject: [PATCH] =?UTF-8?q?p-score:=20Dal=C5=A1=C3=AD=20vylep=C5=A1en?=
=?UTF-8?q?=C3=AD=20pro=20dom=C3=A1c=C3=AD=20kolo?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
bin/p-score | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/bin/p-score b/bin/p-score
index 2cdafad0..d1e69f0f 100755
--- a/bin/p-score
+++ b/bin/p-score
@@ -7,6 +7,7 @@ from sqlalchemy.orm import joinedload
import mo.db as db
from mo.score import Score
from mo.util import die, init_standalone
+from mo.util_format import format_decimal
parser = argparse.ArgumentParser(description='Vygeneruje výsledkovou listinu MO-P')
parser.add_argument('year', type=int)
@@ -35,8 +36,8 @@ def get_results(round, contests):
def write_tex(round, tasks, contests, results):
with open('final.tex', 'w') as out:
- out.write(r'\def\HranicePostupu{%s}' % (round.score_winner_limit,) + "\n")
- out.write(r'\def\HraniceUspesnychResitelu{%s}' % (round.score_successful_limit,) + "\n")
+ out.write(r'\def\HranicePostupu{%s}' % (format_decimal(round.score_winner_limit,)) + "\n")
+ out.write(r'\def\HraniceUspesnychResitelu{%s}' % (format_decimal(round.score_successful_limit),) + "\n")
out.write('\n')
for c in contests:
res = results[c.place.get_code()]
@@ -80,11 +81,11 @@ def write_tex(round, tasks, contests, results):
for t in tasks:
s = sol_map.get(t.task_id)
if s is not None:
- cols.append(s.points)
+ cols.append(format_decimal(s.points))
else:
cols.append('--')
- cols.append(r.get_total_points())
+ cols.append(format_decimal(r.get_total_points()))
out.write("".join(['{' + str(col) + '}' for col in cols]) + '\n')
@@ -130,11 +131,11 @@ def write_html(round, tasks, contests, results):
for t in tasks:
s = sol_map.get(t.task_id)
if s is not None:
- cols.append(s.points)
+ cols.append(format_decimal(s.points))
else:
cols.append('–')
- cols.append(r.get_total_points())
+ cols.append(format_decimal(r.get_total_points()))
out.write("".join(['<td>' + str(col) for col in cols]) + '\n')
--
GitLab