Added check with -xp to get_level

This commit is contained in:
Sven Heidemann 2023-09-10 11:07:37 +02:00
parent 2c3ef97a14
commit 85852bf2f0

View File

@ -40,6 +40,9 @@ class LevelService:
def get_level(self, user: User) -> Level: def get_level(self, user: User) -> Level:
levels_by_server = self._levels.get_levels_by_server_id(user.server.id) levels_by_server = self._levels.get_levels_by_server_id(user.server.id)
if user.xp < 0:
levels_by_server.first()
levels = levels_by_server.order_by(lambda l: l.min_xp).where(lambda l: user.xp >= l.min_xp) levels = levels_by_server.order_by(lambda l: l.min_xp).where(lambda l: user.xp >= l.min_xp)
if levels.count() == 0: if levels.count() == 0: