From 9529b3e328d20070957e82fdc9fb2bf5f0b8f088 Mon Sep 17 00:00:00 2001
From: Martin Mares <mj@ucw.cz>
Date: Mon, 30 Aug 2021 21:34:07 +0200
Subject: [PATCH] =?UTF-8?q?Registrace:=20V=20seznamu=20kol=20uv=C3=A1d?=
 =?UTF-8?q?=C3=ADme=20i=20term=C3=ADny?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 mo/db.py                             | 10 +++++++++-
 mo/web/templates/user_join_list.html |  2 ++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/mo/db.py b/mo/db.py
index 812935da..000d01ca 100644
--- a/mo/db.py
+++ b/mo/db.py
@@ -22,7 +22,7 @@ from typing import Optional, List, Tuple
 
 import mo
 from mo.place_level import place_levels, PlaceLevel
-from mo.util_format import timedelta, time_and_timedelta
+from mo.util_format import timeformat_short, timedelta, time_and_timedelta
 
 # HACK: Work-around for https://github.com/dropbox/sqlalchemy-stubs/issues/114
 from typing import TYPE_CHECKING, TypeVar, Type, Any
@@ -306,6 +306,14 @@ class Round(Base):
             return round_points_step_names[self.points_step]
         return str(self.points_step)
 
+    def format_times(self) -> str:
+        times = []
+        if self.ct_tasks_start is not None:
+            times.append('od ' + timeformat_short(self.ct_tasks_start))
+        if self.ct_submit_end is not None:
+            times.append('do ' + timeformat_short(self.ct_submit_end))
+        return " ".join(times)
+
 
 class User(Base):
     __tablename__ = 'users'
diff --git a/mo/web/templates/user_join_list.html b/mo/web/templates/user_join_list.html
index 453771ec..3f7796f5 100644
--- a/mo/web/templates/user_join_list.html
+++ b/mo/web/templates/user_join_list.html
@@ -11,6 +11,7 @@
 				<th>Kategorie
 				<th>Popis
 				<th>Kolo
+				<th>Termíny
 				<th>Odkazy
 		<tbody>
 			{% for round in available_rounds %}
@@ -18,6 +19,7 @@
 				<td><b>{{ round.category }}</b>
 				<td>{{ round.enroll_advert }}</b>
 				<td>{{ round.name }}
+				<td>{{ round.format_times() }}
 				{% if round.round_id in pcrs_by_round_id %}
 					<td>Již přihlášen
 				{% else %}
-- 
GitLab