From 63e0fb7912b081c6a1e37d9853e46635766ad973 Mon Sep 17 00:00:00 2001
From: Martin Mares <mj@ucw.cz>
Date: Tue, 30 Nov 2021 18:39:20 +0100
Subject: [PATCH] =?UTF-8?q?Web:=20Rozli=C5=A1ov=C3=A1n=C3=AD=20job=C5=AF?=
 =?UTF-8?q?=20ve=20stavu=20failed=20a=20internal=5Ferror?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 mo/web/org_jobs.py                              | 2 +-
 mo/web/templates/org_contest_scans_process.html | 2 +-
 static/mo.css                                   | 8 ++++++++
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/mo/web/org_jobs.py b/mo/web/org_jobs.py
index 8cf9786e..7851eab2 100644
--- a/mo/web/org_jobs.py
+++ b/mo/web/org_jobs.py
@@ -76,7 +76,7 @@ def job_file_size(job: db.Job, name: Optional[str]) -> Optional[int]:
 def org_job(id: int):
     job = get_job(id)
 
-    has_errors = (job.state == db.JobState.failed
+    has_errors = (job.state in (db.JobState.failed, db.JobState.internal_error)
                   and isinstance(job.out_json, dict)
                   and 'errors' in job.out_json)
 
diff --git a/mo/web/templates/org_contest_scans_process.html b/mo/web/templates/org_contest_scans_process.html
index 03af33e3..c6f38425 100644
--- a/mo/web/templates/org_contest_scans_process.html
+++ b/mo/web/templates/org_contest_scans_process.html
@@ -22,7 +22,7 @@ Třídění skenů {{ scans_title }} pro {{ ctx.round.name|lower }} kategorie {{
 <script>
 setTimeout(function () { location.reload(1); }, 10_000);
 </script>
-{% elif job.state == JobState.failed %}
+{% elif job.state != JobState.done %}
 <p>Zpracování selhalo, více detailů naleznete v <a href="{{ url_for('org_job', id=job.job_id) }}">detailu dávky</a>.</p>
 {% else %}
 
diff --git a/static/mo.css b/static/mo.css
index 91cfe734..13b0d8d3 100644
--- a/static/mo.css
+++ b/static/mo.css
@@ -259,6 +259,14 @@ table.data tbody tr.job-failed:hover {
 	background-color: #a66;
 }
 
+table.data tbody tr.job-internal_error {
+	background-color: #c22;
+}
+
+table.data tbody tr.job-internal_error:hover {
+	background-color: #a44;
+}
+
 /* Users */
 
 .user-test {
-- 
GitLab