From e65bd5db43be3bf1bf2cfb86f07fcfafcb52956c Mon Sep 17 00:00:00 2001 From: Drobysh Date: Wed, 14 Oct 2026 09:01:02 +0000 Subject: [PATCH 1/4] =?UTF-8?q?[Eva]=20bubblewords:=20=D1=87=D0=B8=D1=82?= =?UTF-8?q?=D0=B0=D0=B5=D0=BC=20difficulty=20=D0=B8=D0=B7=20users?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/bubblewords.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/routers/bubblewords.py b/routers/bubblewords.py index 0bc4899..8cdf7bd 100644 --- a/routers/bubblewords.py +++ b/routers/bubblewords.py @@ -195,9 +195,11 @@ async def complete_bubble_level(request: Request): if not user_exists: raise HTTPException(401, "User not registered") - current_level = await conn.fetchval( - "SELECT current_level FROM users WHERE telegram_id = $1", telegram_id - ) or "A1" + user = await conn.fetchrow( + "SELECT current_level, difficulty FROM users WHERE telegram_id = $1", telegram_id + ) + current_level = user["current_level"] or "A1" + difficulty = user["difficulty"] or "medium" # Читаем серверный hints_used hints_used = await conn.fetchval( From 5644b5be16d1bc709cc8f88c4cefceaa36823340 Mon Sep 17 00:00:00 2001 From: Drobysh Date: Wed, 14 Oct 2026 09:01:12 +0000 Subject: [PATCH 2/4] =?UTF-8?q?[Eva]=20bubblewords:=20=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D1=8F=20=D1=84=D0=BE=D1=80=D0=BC=D1=83=D0=BB=D0=B0=20?= =?UTF-8?q?=D0=BE=D1=87=D0=BA=D0=BE=D0=B2=20=D0=B2=D0=BC=D0=B5=D1=81=D1=82?= =?UTF-8?q?=D0=BE=20=D0=B7=D0=B2=D1=91=D0=B7=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/bubblewords.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/routers/bubblewords.py b/routers/bubblewords.py index 8cdf7bd..500336d 100644 --- a/routers/bubblewords.py +++ b/routers/bubblewords.py @@ -208,17 +208,24 @@ async def complete_bubble_level(request: Request): ) or 0 hints_used = min(max(0, hints_used), 3) - # 🆕 Расчёт звёзд - # Старт 5. Штрафы: hints(1) + wrong_words(до 3) + time(1) - time_penalty = 1 if (completion_time and completion_time > 60) else 0 - wrong_penalty = min(max(0, wrong_words), 3) - hint_penalty = 1 if hints_used > 0 else 0 - list_penalty = 1 if list_opened else 0 - stars = max(1, 5 - time_penalty - wrong_penalty - hint_penalty - list_penalty) + # 🔧 НОВОЕ (14.10.2026): очки по формуле филворда. + # Hard — фикс 110. Easy/Medium — 100 − 20×hints − 20×list + bonus. + if difficulty == "hard": + if hints_used > 0 or list_opened: + raise HTTPException( + status_code=400, + detail="Hints and word list are disabled on Hard difficulty" + ) + points = 110 + else: + bonus = 10 if hints_used == 0 else 0 + penalty_hints = 20 * hints_used + penalty_list = 0 if difficulty == "easy" else 20 * (1 if list_opened else 0) + points = max(20, min(110, 100 - penalty_hints - penalty_list + bonus)) # Начисляем XP from services.xp import award_xp - xp_result = await award_xp(conn, telegram_id, "bubbles", stars) + xp_result = await award_xp(conn, telegram_id, "bubbles", points) score = xp_result["points"] await conn.execute(""" From 741d1799e7b0b68c10278ca2f83353f6b73e7427 Mon Sep 17 00:00:00 2001 From: Drobysh Date: Wed, 14 Oct 2026 09:01:21 +0000 Subject: [PATCH 3/4] =?UTF-8?q?[Eva]=20bubblewords:=20bubble=5Fperfect=20?= =?UTF-8?q?=D0=BF=D0=BE=20=D0=BD=D0=BE=D0=B2=D0=BE=D0=B9=20=D0=BB=D0=BE?= =?UTF-8?q?=D0=B3=D0=B8=D0=BA=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/bubblewords.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/bubblewords.py b/routers/bubblewords.py index 500336d..fa13c72 100644 --- a/routers/bubblewords.py +++ b/routers/bubblewords.py @@ -250,7 +250,7 @@ async def complete_bubble_level(request: Request): ] if hints_used == 0: achievements_to_check.append(("bubble_no_hints", 1)) - if stars == 5: + if hints_used == 0 and not list_opened and wrong_words == 0: achievements_to_check.append(("bubble_perfect", 1)) if completion_time is not None and 0 < completion_time <= 45: achievements_to_check.append(("bubble_speed", 45)) From 4159d6265adddfdd4f055d427aa4ffb3b963f930 Mon Sep 17 00:00:00 2001 From: Drobysh Date: Wed, 14 Oct 2026 09:01:33 +0000 Subject: [PATCH 4/4] =?UTF-8?q?[Eva]=20bubblewords:=20=D1=83=D0=B1=D0=B8?= =?UTF-8?q?=D1=80=D0=B0=D1=8E=20xp=5Fresult["stars"]=20(KeyError)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/bubblewords.py | 1 - 1 file changed, 1 deletion(-) diff --git a/routers/bubblewords.py b/routers/bubblewords.py index fa13c72..00189a8 100644 --- a/routers/bubblewords.py +++ b/routers/bubblewords.py @@ -270,7 +270,6 @@ async def complete_bubble_level(request: Request): "completion_time": completion_time, "new_achievements": new_achievements, # 🆕 XP-поля - "stars": xp_result["stars"], "base_points": xp_result["base_points"], "multiplier": xp_result["multiplier"], "points": xp_result["points"],