From 4bb776f8019b8d58f7b65a95d67e74292c5ce352 Mon Sep 17 00:00:00 2001 From: Kobe Date: Sat, 31 May 2025 12:18:52 +0200 Subject: [PATCH] fix paging on events --- routes/__pycache__/main.cpython-313.pyc | Bin 47597 -> 47635 bytes routes/__pycache__/room_files.cpython-313.pyc | Bin 47025 -> 47025 bytes routes/main.py | 7 ++++++- templates/settings/settings.html | 2 +- templates/settings/tabs/events.html | 18 +++++++++++++++--- 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/routes/__pycache__/main.cpython-313.pyc b/routes/__pycache__/main.cpython-313.pyc index 761ab544cb1ed4cd31ae733cdcb656cd741f433d..cf1083a1e6015345d57c65190935d1168dc48f35 100644 GIT binary patch delta 305 zcmaF+nQ8JDCce+Syj%=GaQm87M!?jKd>4`!XH34I^o8jp!{m>POg3|-#4_{ya|AQw zF$J^bF$c5fvFLA3PPb=c{5JXFD$&V072=!E=e9A5bh&G z*yhmuJsgaWHw#s~Vqp~9{I_N^52M!Rjh$aP8M`JgpS+H-V{_OPE=Iw8-{w23irJNY7#SFfe1U`}>n)Ddvedki z_{@}BtYB6V3rI3xa?z$3M%K;eH>omlhl4~80=-u(I62TRXR6ig_`z u8hmDEU=slm3LjWN{0|YE8Mj+7F~&`{+9}JJH#uTw4`%=mqgs&;&4`!+a}*n`oeUAVX|+s$!5-!Smwd_003~%cht@Xou&aUuf|l06hu-dq-B< diff --git a/routes/__pycache__/room_files.cpython-313.pyc b/routes/__pycache__/room_files.cpython-313.pyc index 89e16b88e34215dd9862411bb9f466ba2ec81639..d4ac50d493b9024b3ac817790911da602d5aa1c6 100644 GIT binary patch delta 21 bcmdn^o@wKICa%xCyj%=GkgKwhYx#BnRhb76 delta 21 bcmdn^o@wKICa%xCyj%=GaEoOl*YfQESBD2( diff --git a/routes/main.py b/routes/main.py index 206733b..d13d07e 100644 --- a/routes/main.py +++ b/routes/main.py @@ -448,6 +448,11 @@ def init_routes(main_bp): # Get all users for filter dropdown users = User.query.order_by(User.username).all() + else: + events = None + total_pages = 0 + current_page = 1 + users = [] # Create form for company settings company_form = CompanySettingsForm() @@ -706,7 +711,7 @@ def init_routes(main_bp): date_range = request.args.get('date_range', '7d') user_id = request.args.get('user_id') page = request.args.get('page', 1, type=int) - per_page = 50 + per_page = 10 # Calculate date range end_date = datetime.utcnow() diff --git a/templates/settings/settings.html b/templates/settings/settings.html index 9662c52..d5c4dc0 100644 --- a/templates/settings/settings.html +++ b/templates/settings/settings.html @@ -73,7 +73,7 @@
- {{ events_tab(events, csrf_token, users) }} + {{ events_tab(events, csrf_token, users, total_pages, current_page) }}
diff --git a/templates/settings/tabs/events.html b/templates/settings/tabs/events.html index 7aa6528..d18a71c 100644 --- a/templates/settings/tabs/events.html +++ b/templates/settings/tabs/events.html @@ -1,4 +1,4 @@ -{% macro events_tab(events, csrf_token, users) %} +{% macro events_tab(events, csrf_token, users, total_pages=0, current_page=1) %}
@@ -156,9 +156,21 @@
- + Page {{ current_page }} of {{ total_pages }} - +