Users für FreeDrinkListHistory
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.
This commit is contained in:
parent
1f5eb0be9d
commit
fe7b81a534
|
@ -172,6 +172,7 @@ class Base:
|
||||||
data['free_drink_type'] = self.get_free_drink_list_type(data['free_drink_type_id'])
|
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'] = self.get_free_drink_list_reason(data['free_drink_list_reason_id']) if \
|
||||||
data['free_drink_list_reason_id'] else None
|
data['free_drink_list_reason_id'] else None
|
||||||
|
data['user'] = self.getUserById(data['user_id'], workgroups=False, geruecht=False).toJSON()
|
||||||
return retVal
|
return retVal
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
|
@ -48,7 +48,7 @@ class Base:
|
||||||
self.db.connection.rollback()
|
self.db.connection.rollback()
|
||||||
raise DatabaseExecption("Something went worng with Datatabase: {}".format(err))
|
raise DatabaseExecption("Something went worng with Datatabase: {}".format(err))
|
||||||
|
|
||||||
def getUserById(self, id, workgroups=True):
|
def getUserById(self, id, workgroups=True, geruecht=True):
|
||||||
try:
|
try:
|
||||||
retVal = None
|
retVal = None
|
||||||
cursor = self.db.connection.cursor()
|
cursor = self.db.connection.cursor()
|
||||||
|
@ -56,8 +56,9 @@ class Base:
|
||||||
data = cursor.fetchone()
|
data = cursor.fetchone()
|
||||||
if data:
|
if data:
|
||||||
retVal = User(data)
|
retVal = User(data)
|
||||||
creditLists = self.getCreditListFromUser(retVal)
|
if geruecht:
|
||||||
retVal.initGeruechte(creditLists)
|
creditLists = self.getCreditListFromUser(retVal)
|
||||||
|
retVal.initGeruechte(creditLists)
|
||||||
if workgroups:
|
if workgroups:
|
||||||
retVal.workgroups = self.getWorkgroupsOfUser(retVal.id)
|
retVal.workgroups = self.getWorkgroupsOfUser(retVal.id)
|
||||||
return retVal
|
return retVal
|
||||||
|
|
Loading…
Reference in New Issue