From 049e07d2e16a82a6b18fb319729f4363ed667b5c Mon Sep 17 00:00:00 2001 From: Martin Mares <mj@ucw.cz> Date: Tue, 14 Apr 2020 14:08:45 +0200 Subject: [PATCH] App: Show current time --- app/static/mffzoom.css | 7 +++++++ app/templates/main.html | 3 +++ app/zoom.py | 9 +++++++++ 3 files changed, 19 insertions(+) diff --git a/app/static/mffzoom.css b/app/static/mffzoom.css index 16a8bf6..e957ae1 100644 --- a/app/static/mffzoom.css +++ b/app/static/mffzoom.css @@ -68,3 +68,10 @@ body { margin-top: 0.5ex; font-size: 9px; } + +#now { + height: 1px; + background-color: #cc0000; + opacity: 0.3; + z-index: 10; +} diff --git a/app/templates/main.html b/app/templates/main.html index ddbadc6..f6cced3 100644 --- a/app/templates/main.html +++ b/app/templates/main.html @@ -51,6 +51,9 @@ <p class=mdesc>{{ m.topic }} </div> {% endfor %} +{% if g.now %} + <div id=now style='position: absolute; left: {{ g.now.x }}px; top: {{ g.now.y }}px; width: {{ g.now.w }}px;'></div> +{% endif %} </div> </body> </html> diff --git a/app/zoom.py b/app/zoom.py index c240b9f..0c0f950 100644 --- a/app/zoom.py +++ b/app/zoom.py @@ -151,6 +151,15 @@ def main_page(): "label": (dt + timedelta(seconds = first_slot + i*slot_size)).strftime("%H:%M"), } for i in range(num_slots)] + dt_now = datetime.now(tz=dateutil.tz.tzlocal()) + rel_now = dt_now.timestamp() - dt.timestamp() - first_slot + if rel_now > 0 and rel_now < num_slots * slot_size: + g.now = { + "x": 0, + "y": int(rel_now / 3600. * room_hour_height), + "w": row_offset + num_rooms * room_box_width + 20, + } + # XXX: No meeting is ever longer than 24 hours db_query(""" SELECT m.meeting_id, m.topic, s.start_time, s.duration, u.email, u.full_name -- GitLab