Skip to content
Snippets Groups Projects
Commit 4ad1cd40 authored by Martin Mareš's avatar Martin Mareš
Browse files

p-score: Další vylepšení pro domácí kolo

parent a9ba513e
No related branches found
No related tags found
No related merge requests found
...@@ -7,6 +7,7 @@ from sqlalchemy.orm import joinedload ...@@ -7,6 +7,7 @@ from sqlalchemy.orm import joinedload
import mo.db as db import mo.db as db
from mo.score import Score from mo.score import Score
from mo.util import die, init_standalone 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 = argparse.ArgumentParser(description='Vygeneruje výsledkovou listinu MO-P')
parser.add_argument('year', type=int) parser.add_argument('year', type=int)
...@@ -35,8 +36,8 @@ def get_results(round, contests): ...@@ -35,8 +36,8 @@ def get_results(round, contests):
def write_tex(round, tasks, contests, results): def write_tex(round, tasks, contests, results):
with open('final.tex', 'w') as out: with open('final.tex', 'w') as out:
out.write(r'\def\HranicePostupu{%s}' % (round.score_winner_limit,) + "\n") out.write(r'\def\HranicePostupu{%s}' % (format_decimal(round.score_winner_limit,)) + "\n")
out.write(r'\def\HraniceUspesnychResitelu{%s}' % (round.score_successful_limit,) + "\n") out.write(r'\def\HraniceUspesnychResitelu{%s}' % (format_decimal(round.score_successful_limit),) + "\n")
out.write('\n') out.write('\n')
for c in contests: for c in contests:
res = results[c.place.get_code()] res = results[c.place.get_code()]
...@@ -80,11 +81,11 @@ def write_tex(round, tasks, contests, results): ...@@ -80,11 +81,11 @@ def write_tex(round, tasks, contests, results):
for t in tasks: for t in tasks:
s = sol_map.get(t.task_id) s = sol_map.get(t.task_id)
if s is not None: if s is not None:
cols.append(s.points) cols.append(format_decimal(s.points))
else: else:
cols.append('--') 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') out.write("".join(['{' + str(col) + '}' for col in cols]) + '\n')
...@@ -130,11 +131,11 @@ def write_html(round, tasks, contests, results): ...@@ -130,11 +131,11 @@ def write_html(round, tasks, contests, results):
for t in tasks: for t in tasks:
s = sol_map.get(t.task_id) s = sol_map.get(t.task_id)
if s is not None: if s is not None:
cols.append(s.points) cols.append(format_decimal(s.points))
else: else:
cols.append('') 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') out.write("".join(['<td>' + str(col) for col in cols]) + '\n')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment