From fe7b81a5349b6f5c311d92d24b56de72dfc84f4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Mon, 24 Aug 2020 14:05:50 +0200 Subject: [PATCH] =?UTF-8?q?Users=20f=C3=BCr=20FreeDrinkListHistory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Der User wird mit gesenden, wenn man die FreeDrinkListHistory abruft. Dabei wurde die Funktion des Users angepasst, dass nicht ständig, das komplette Gerücht neu initialisiert wird. --- .../databaseController/dbFreeDrinkListConfigController.py | 1 + geruecht/controller/databaseController/dbUserController.py | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/geruecht/controller/databaseController/dbFreeDrinkListConfigController.py b/geruecht/controller/databaseController/dbFreeDrinkListConfigController.py index dabb926..1481260 100644 --- a/geruecht/controller/databaseController/dbFreeDrinkListConfigController.py +++ b/geruecht/controller/databaseController/dbFreeDrinkListConfigController.py @@ -172,6 +172,7 @@ class Base: data['free_drink_type'] = self.get_free_drink_list_type(data['free_drink_type_id']) data['free_drink_list_reason'] = self.get_free_drink_list_reason(data['free_drink_list_reason_id']) if \ data['free_drink_list_reason_id'] else None + data['user'] = self.getUserById(data['user_id'], workgroups=False, geruecht=False).toJSON() return retVal except Exception as err: traceback.print_exc() diff --git a/geruecht/controller/databaseController/dbUserController.py b/geruecht/controller/databaseController/dbUserController.py index 3e419d4..4c1dd1c 100644 --- a/geruecht/controller/databaseController/dbUserController.py +++ b/geruecht/controller/databaseController/dbUserController.py @@ -48,7 +48,7 @@ class Base: self.db.connection.rollback() raise DatabaseExecption("Something went worng with Datatabase: {}".format(err)) - def getUserById(self, id, workgroups=True): + def getUserById(self, id, workgroups=True, geruecht=True): try: retVal = None cursor = self.db.connection.cursor() @@ -56,8 +56,9 @@ class Base: data = cursor.fetchone() if data: retVal = User(data) - creditLists = self.getCreditListFromUser(retVal) - retVal.initGeruechte(creditLists) + if geruecht: + creditLists = self.getCreditListFromUser(retVal) + retVal.initGeruechte(creditLists) if workgroups: retVal.workgroups = self.getWorkgroupsOfUser(retVal.id) return retVal