From e12171dc87be4d2c54e7ffe6adcc2dc5b02cdccf Mon Sep 17 00:00:00 2001 From: Matt Soucy Date: Tue, 14 Jan 2025 19:34:12 -0500 Subject: [PATCH] feat: Total time tracker for event --- signinapp/events.py | 3 +++ signinapp/templates/event_stats.html.jinja2 | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/signinapp/events.py b/signinapp/events.py index c4fa035..1f96c0b 100644 --- a/signinapp/events.py +++ b/signinapp/events.py @@ -218,9 +218,11 @@ def stats(): users = defaultdict(timedelta) subteams = defaultdict(timedelta) blocks = defaultdict(list) + total_time = timedelta() for stamp in event.stamps: users[stamp.user] += stamp.elapsed subteams[stamp.user.subteam] += stamp.elapsed + total_time += stamp.elapsed now = datetime.now(tz=UTC) for active in event.active: users[active.user] += now - correct_time_from_storage(active.start) @@ -252,6 +254,7 @@ def stats(): subteams=subteams, blocks=blocks, registration_url=registration_url, + total_time=total_time, ) diff --git a/signinapp/templates/event_stats.html.jinja2 b/signinapp/templates/event_stats.html.jinja2 index 9a7b5ea..77f6e1b 100644 --- a/signinapp/templates/event_stats.html.jinja2 +++ b/signinapp/templates/event_stats.html.jinja2 @@ -114,6 +114,13 @@ {%- endfor -%} + + + TOTAL + {{ total_time }} + {{ event.funds_human }} + +