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,