Skip to content
Snippets Groups Projects
Commit e9e8c153 authored by Jiří Setnička's avatar Jiří Setnička
Browse files

Joby výsledkovek: Vyšší priorita a lepší názvy jobů

Issue #292 (jména jobů) a #294 (prioritní joby).
parent 46d00fb7
Branches
No related tags found
1 merge request!124Zjednodušení práce s joby
......@@ -46,7 +46,7 @@ for round in rounds:
print('Publikoval bych')
else:
print('Publikuji')
mo.jobs.score.schedule_export_score_to_mo_web(contest.scoretable)
mo.jobs.score.schedule_export_score_to_mo_web(contest, contest.scoretable)
if not args.dry_run:
sess.commit()
......@@ -32,8 +32,8 @@ from mo.util_format import format_decimal
def schedule_snapshot_score(contest: db.Contest, for_user: db.User, snapshot_note: str) -> None:
the_job = TheJob()
job = the_job.create(db.JobType.snapshot_score, for_user)
job.description = 'Zmrazení aktuálního stavu výsledkové listiny'
job = the_job.create(db.JobType.snapshot_score, for_user, priority=1)
job.description = f'Zmrazení aktuálního stavu výsledkové listiny {contest.round.round_code_short()} {contest.place.name_locative()}'
job.in_json = {"contest_id": contest.contest_id, "snapshot_note": snapshot_note}
the_job.submit()
......@@ -263,10 +263,10 @@ def api_params(contest: db.Contest) -> Dict[str, Any]:
}
def schedule_export_score_to_mo_web(score_table: db.ScoreTable) -> None:
def schedule_export_score_to_mo_web(contest: db.Contest, score_table: db.ScoreTable) -> None:
the_job = TheJob()
job = the_job.create(db.JobType.export_score_to_mo_web, db.get_system_user())
job.description = 'Publikování výsledkové listiny na webu MO'
job = the_job.create(db.JobType.export_score_to_mo_web, db.get_system_user(), priority=1)
job.description = f'Publikování výsledkové listiny {contest.round.round_code_short()} {contest.place.name_locative()} na webu MO'
job.in_json = {"scoretable_id": score_table.scoretable_id}
the_job.submit()
......@@ -423,8 +423,8 @@ def handle_export_score_to_mo_web(the_job: TheJob):
def schedule_revert_export_score_to_mo_web(contest: db.Contest) -> None:
the_job = TheJob()
job = the_job.create(db.JobType.revert_export_score_to_mo_web, db.get_system_user())
job.description = 'Zrušení publikování výsledkové listiny na webu MO'
job = the_job.create(db.JobType.revert_export_score_to_mo_web, db.get_system_user(), priority=1)
job.description = f'Zrušení publikování výsledkové listiny {contest.round.round_code_short()} {contest.place.name_locative()} na webu MO'
job.in_json = {"contest_id": contest.contest_id}
the_job.submit()
......
......@@ -297,7 +297,7 @@ def org_score_snapshots(ct_id: int):
break
if found and set_final_form.submit_set_final:
ctx.contest.scoretable_id = scoretable_id
mo.jobs.score.schedule_export_score_to_mo_web(scoretable)
mo.jobs.score.schedule_export_score_to_mo_web(ctx.contest, scoretable)
mo.util.log(
type=db.LogType.contest,
what=ctx.contest.contest_id,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment