diff --git a/bin/p-score b/bin/p-score
index 2cdafad0b6619af94be1fbddcb4e0d750a707b5d..d1e69f0f75caaed51e28764d973f6ff11de494d4 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')