[Eva] ChooseWord /check: очки по сложности вместо звёзд

This commit is contained in:
2026-10-15 17:02:06 +00:00
parent af3c634bfd
commit 7e8c0e132e
+10 -8
View File
@@ -194,17 +194,19 @@ async def check_quiz_answer(request: Request):
score = 0
if is_correct:
# 🆕 Расчёт звёзд для "Выбери слово"
# Старт 5 звёзд. Штрафы:
# -1 за каждый неверный (макс 3)
# -1 если time > 30 сек
time_penalty = 1 if (completion_time and completion_time > 30) else 0
wrong_penalty = min(mistakes, 3)
stars = max(1, 5 - wrong_penalty - time_penalty)
# 🆕 Фиксированные очки по сложности (ChooseWord)
if difficulty == "easy":
points = max(20, min(60, 60 - 20 * mistakes))
elif difficulty == "medium":
points = max(20, min(80, 80 - 20 * mistakes))
else: # hard
points = max(20, min(110, 110 - 20 * mistakes))
if completion_time is not None and completion_time > 10:
points = 20
# Начисляем XP
from services.xp import award_xp
xp_result = await award_xp(conn, telegram_id, "choose", stars)
xp_result = await award_xp(conn, telegram_id, "choose", points)
score = xp_result["points"]
# Сбрасываем mistakes + обновляем серию