fixed that baruser get endsum not only from month
This commit is contained in:
parent
16e50ea751
commit
3a5d7d7d0f
|
@ -29,15 +29,16 @@ def _bar():
|
||||||
if geruecht is not None:
|
if geruecht is not None:
|
||||||
month = geruecht.getMonth(datetime.now().month)
|
month = geruecht.getMonth(datetime.now().month)
|
||||||
amount = month[0] - month[1]
|
amount = month[0] - month[1]
|
||||||
|
all = geruecht.getSchulden()
|
||||||
if amount != 0:
|
if amount != 0:
|
||||||
if amount >= 0:
|
if all >= 0:
|
||||||
type = 'credit'
|
type = 'credit'
|
||||||
else:
|
else:
|
||||||
type = 'amount'
|
type = 'amount'
|
||||||
dic[user.uid] = {"username": user.uid,
|
dic[user.uid] = {"username": user.uid,
|
||||||
"firstname": user.firstname,
|
"firstname": user.firstname,
|
||||||
"lastname": user.lastname,
|
"lastname": user.lastname,
|
||||||
"amount": abs(month[0] - month[1]),
|
"amount": abs(all),
|
||||||
"locked": user.locked,
|
"locked": user.locked,
|
||||||
"type": type
|
"type": type
|
||||||
}
|
}
|
||||||
|
@ -66,10 +67,16 @@ def _baradd():
|
||||||
date = datetime.now()
|
date = datetime.now()
|
||||||
userController.addAmount(userID, amount, year=date.year, month=date.month)
|
userController.addAmount(userID, amount, year=date.year, month=date.month)
|
||||||
user = userController.getUser(userID)
|
user = userController.getUser(userID)
|
||||||
month = user.getGeruecht(year=date.year).getMonth(month=date.month)
|
geruecht = user.getGeruecht(year=date.year)
|
||||||
|
month = geruecht.getMonth(month=date.month)
|
||||||
amount = abs(month[0] - month[1])
|
amount = abs(month[0] - month[1])
|
||||||
|
all = geruecht.getSchulden()
|
||||||
|
if all >= 0:
|
||||||
|
type = 'credit'
|
||||||
|
else:
|
||||||
|
type = 'amount'
|
||||||
|
|
||||||
return jsonify({"userId": user.uid, "amount": amount, 'locked': user.locked})
|
return jsonify({"userId": user.uid, "amount": abs(all), 'locked': user.locked, 'type': type})
|
||||||
return jsonify({"error", "permission denied"}), 401
|
return jsonify({"error", "permission denied"}), 401
|
||||||
|
|
||||||
@baruser.route("/barGetUsers")
|
@baruser.route("/barGetUsers")
|
||||||
|
|
Loading…
Reference in New Issue