Skip to content
Snippets Groups Projects

Automatická oprava rozbitých PDF

Merged
Martin Marešrequested to merge
mj/auto-fix-jobs into devel
1 open thread

Files

+ 9
8
@@ -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,12 +36,12 @@ 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()]
if round.seq == 2:
if round.seq <= 2:
out.write(r'\kraj{%s}' % c.place.name + '\n')
if not res:
out.write(r'\nobody' + '\n')
@@ -80,16 +81,16 @@ 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')
out.write(r'\endtable' + '\n')
if round.seq == 2:
if round.seq <= 2:
out.write(r'\endkraj' + '\n\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')
Loading