From 7ac3813782cb6a8fb4876d920947866c6097e829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Thu, 20 Aug 2020 20:17:35 +0200 Subject: [PATCH] bugfix, free_drink_list_history wenn kein dienst Sollte der user, der diese liste abruft keinen dienst haben, wird nur die history der letzten halben stunde abgerufen --- .../databaseController/dbFreeDrinkListConfigController.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/geruecht/controller/databaseController/dbFreeDrinkListConfigController.py b/geruecht/controller/databaseController/dbFreeDrinkListConfigController.py index 269179c..e17723f 100644 --- a/geruecht/controller/databaseController/dbFreeDrinkListConfigController.py +++ b/geruecht/controller/databaseController/dbFreeDrinkListConfigController.py @@ -97,7 +97,11 @@ class Base: cursor = self.db.connection.cursor() now = datetime.now() worker = self.getWorker(user, now) - cursor.execute(f'select * from free_drink_list_history where timestamp>="{worker["startdatetime"]}" and (user_id={user.id} or free_drink_type_id=3)') + if worker: + timestamp = worker["startdatetime"] + else: + timestamp = datetime.now() - timedelta(minutes=30) + cursor.execute(f'select * from free_drink_list_history where timestamp>="{timestamp}" and (user_id={user.id} or free_drink_type_id=3)') retVal = cursor.fetchall() for data in retVal: data['timestamp'] = {'year': data['timestamp'].year,