Fixed xp input #285
This commit is contained in:
parent
1960b18058
commit
27363522d3
@ -37,12 +37,13 @@ class UserMutation(QueryABC):
|
|||||||
user = self._users.get_user_by_id(input["id"])
|
user = self._users.get_user_by_id(input["id"])
|
||||||
self._can_user_mutate_data(user.server, UserRoleEnum.moderator)
|
self._can_user_mutate_data(user.server, UserRoleEnum.moderator)
|
||||||
|
|
||||||
|
new_xp = None
|
||||||
if "levelId" in input:
|
if "levelId" in input:
|
||||||
level = self._levels.get_level_by_id(input["levelId"])
|
level = self._levels.get_level_by_id(input["levelId"])
|
||||||
if user.level.id != level.id:
|
if user.level.id != level.id:
|
||||||
user.xp = level.min_xp
|
new_xp = level.min_xp
|
||||||
else:
|
|
||||||
user.xp = input["xp"] if "xp" in input else user.xp
|
user.xp = new_xp if new_xp is not None else input["xp"] if "xp" in input else user.xp
|
||||||
|
|
||||||
self._users.update_user(user)
|
self._users.update_user(user)
|
||||||
self._db.save_changes()
|
self._db.save_changes()
|
||||||
|
Loading…
Reference in New Issue
Block a user