diff options
Diffstat (limited to 'jimbrella/admin.py')
-rw-r--r-- | jimbrella/admin.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/jimbrella/admin.py b/jimbrella/admin.py index 4454c69..8a52bb8 100644 --- a/jimbrella/admin.py +++ b/jimbrella/admin.py @@ -29,16 +29,16 @@ def check_privilege(): def index(): umbrellas = db.read() # count # of umbrellas in each status - statuses = { + status_count = { status: len([u for u in umbrellas if u["status"] == status]) for status in ("available", "lent", "overdue") } return render_template( "admin/index.html", - umbrellas=umbrellas, - available=statuses["available"], - lent=statuses["lent"], - overdue=statuses["overdue"], + umbrellas=len(umbrellas), + available=status_count["available"], + lent=status_count["lent"], + overdue=status_count["overdue"], mobile=user_agent(request.user_agent.string).is_mobile, ) @@ -56,7 +56,7 @@ def umbrellas(): return render_template( template, umbrellas=umbrellas, - edit=int(edit) if edit.isnumeric() else None, + edit=int(edit) if edit is not None and edit.isnumeric() else None, error=error, ) |