From b85fffa382f020e5c81db30641f93b3820ce7a36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sondre=20Gr=C3=B8n=C3=A5s?= <44143748+sondregronas@users.noreply.github.com> Date: Wed, 1 Nov 2023 12:24:07 +0100 Subject: [PATCH] Bugfix when borrowing for more than 30 days, fix sorting --- BookingSystem/inventory.py | 2 +- BookingSystem/templates/index_admin.html | 4 ++-- BookingSystem/templates/innlevering.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/BookingSystem/inventory.py b/BookingSystem/inventory.py index 4bc23bc..6b5790e 100644 --- a/BookingSystem/inventory.py +++ b/BookingSystem/inventory.py @@ -259,7 +259,7 @@ def _update_last_seen(item_id: str) -> None: def register_out(item_id: str, userid: str, days: str = 1) -> None: """Set the item with the given ID to unavailable and register the order details.""" - due_date = datetime.now() + timedelta(days=datetime.strptime(days, '%d').day) + due_date = datetime.now() + timedelta(days=int(days)) item = get(item_id) if item.available == 0: diff --git a/BookingSystem/templates/index_admin.html b/BookingSystem/templates/index_admin.html index 7587b13..c62ac06 100644 --- a/BookingSystem/templates/index_admin.html +++ b/BookingSystem/templates/index_admin.html @@ -55,7 +55,7 @@