Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions handlers/admin/character_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ async def on_rating_input(message: Message, widget: ManagedTextInput, dialog_man

user = await User.get(id=character_id)

if abs(user.rating - rating) > settings.MAX_ONE_TIME_RATING:
await message.answer(f"❌ Изменение рейтинга не может превышать {settings.MAX_ONE_TIME_RATING} за раз")
return

rating = min(max(0, rating), settings.MAX_RATING)

user.rating = rating
Expand Down
3 changes: 2 additions & 1 deletion services/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ class Settings(BaseSettings):
MAX_TITLE_LEN: int = 255
MAX_DESCRIPTION_LEN: int = 1023
MAX_LEVEL: int = 20 # D&D максимальный уровень
MAX_RATING: int = 1000
MAX_RATING: int = 100_000
MAX_ONE_TIME_RATING: int = 200
MAX_ITEM_QUANTITY: int = 1000

# ^ PostgreSQL
Expand Down