[Eva] Ева, начинаем новую игру ChooseWord («Уг #47

Merged
Drobysh merged 21 commits from eva/chat-d4b957-backend into main 2026-10-15 17:11:33 +00:00
Showing only changes of commit 7e8c0e132e - Show all commits
+10 -8
View File
@@ -194,17 +194,19 @@ async def check_quiz_answer(request: Request):
score = 0 score = 0
if is_correct: if is_correct:
# 🆕 Расчёт звёзд для "Выбери слово" # 🆕 Фиксированные очки по сложности (ChooseWord)
# Старт 5 звёзд. Штрафы: if difficulty == "easy":
# -1 за каждый неверный (макс 3) points = max(20, min(60, 60 - 20 * mistakes))
# -1 если time > 30 сек elif difficulty == "medium":
time_penalty = 1 if (completion_time and completion_time > 30) else 0 points = max(20, min(80, 80 - 20 * mistakes))
wrong_penalty = min(mistakes, 3) else: # hard
stars = max(1, 5 - wrong_penalty - time_penalty) points = max(20, min(110, 110 - 20 * mistakes))
if completion_time is not None and completion_time > 10:
points = 20
# Начисляем XP # Начисляем XP
from services.xp import award_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"] score = xp_result["points"]
# Сбрасываем mistakes + обновляем серию # Сбрасываем mistakes + обновляем серию