diff --git a/kdb-bot/src/bot_graphql/mutations/user_mutation.py b/kdb-bot/src/bot_graphql/mutations/user_mutation.py index 44ef7070..9cd71438 100644 --- a/kdb-bot/src/bot_graphql/mutations/user_mutation.py +++ b/kdb-bot/src/bot_graphql/mutations/user_mutation.py @@ -37,12 +37,13 @@ class UserMutation(QueryABC): user = self._users.get_user_by_id(input["id"]) self._can_user_mutate_data(user.server, UserRoleEnum.moderator) + new_xp = None if "levelId" in input: level = self._levels.get_level_by_id(input["levelId"]) if user.level.id != level.id: - user.xp = level.min_xp - else: - user.xp = input["xp"] if "xp" in input else user.xp + new_xp = level.min_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._db.save_changes()