From e9e8c1538d2a5ac5d62c316f5be02344990361ba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Setni=C4=8Dka?= <setnicka@seznam.cz>
Date: Sat, 8 Oct 2022 21:51:04 +0200
Subject: [PATCH] =?UTF-8?q?Joby=20v=C3=BDsledkovek:=20Vy=C5=A1=C5=A1=C3=AD?=
 =?UTF-8?q?=20priorita=20a=20lep=C5=A1=C3=AD=20n=C3=A1zvy=20job=C5=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Issue #292 (jména jobů) a #294 (prioritní joby).
---
 bin/publish-score   |  2 +-
 mo/jobs/score.py    | 14 +++++++-------
 mo/web/org_score.py |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/bin/publish-score b/bin/publish-score
index d4b8ede9..a9d23749 100755
--- a/bin/publish-score
+++ b/bin/publish-score
@@ -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()
diff --git a/mo/jobs/score.py b/mo/jobs/score.py
index d8f19c6a..ae96f2b6 100644
--- a/mo/jobs/score.py
+++ b/mo/jobs/score.py
@@ -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()
 
diff --git a/mo/web/org_score.py b/mo/web/org_score.py
index e4b8995d..a3cbad50 100644
--- a/mo/web/org_score.py
+++ b/mo/web/org_score.py
@@ -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,
-- 
GitLab