From 25b1437e0b1f0443e9f98502ba6185d58e710b30 Mon Sep 17 00:00:00 2001 From: Drobysh Date: Thu, 15 Oct 2026 08:12:49 +0000 Subject: [PATCH] =?UTF-8?q?[Eva]=20=D0=9D=D0=B0=D0=BA=D0=BE=D0=BF=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=81=D1=87=D1=91=D1=82=D1=87=D0=B8?= =?UTF-8?q?=D0=BA=D0=BE=D0=B2=20words=5Fcollected/no=5Fhints=5Fstreak/perf?= =?UTF-8?q?ect=5Fstreak=20=D0=B2=20/complete?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/bubblewords.py | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/routers/bubblewords.py b/routers/bubblewords.py index 3b4fef4..a9789b5 100644 --- a/routers/bubblewords.py +++ b/routers/bubblewords.py @@ -389,11 +389,16 @@ async def complete_bubble_level(request: Request): xp_result = await award_xp(conn, telegram_id, "bubbles", points) score = xp_result["points"] + # πŸ”§ ΠΠžΠ’ΠžΠ• (15.10.2026): Ρ„Π»Π°Π³ΠΈ для накоплСния сСрий. + no_hints_clean = 1 if (hints_used == 0 and not list_opened) else 0 + perfect_clean = 1 if (hints_used == 0 and not list_opened and wrong_words == 0) else 0 + await conn.execute(""" INSERT INTO bubble_words_progress (user_id, levels_completed, total_score, level, - current_hints_used, current_list_opened, current_level_words, hinted_words) - VALUES ($1, 1, $2, $3, 0, 0, '[]'::jsonb, '{}') + current_hints_used, current_list_opened, current_level_words, hinted_words, + words_collected, no_hints_streak, perfect_streak) + VALUES ($1, 1, $2, $3, 0, 0, '[]'::jsonb, '{}', $4, $5, $6) ON CONFLICT (user_id) DO UPDATE SET levels_completed = bubble_words_progress.levels_completed + 1, total_score = bubble_words_progress.total_score + $2, @@ -401,8 +406,23 @@ async def complete_bubble_level(request: Request): current_hints_used = 0, current_list_opened = 0, current_level_words = '[]'::jsonb, - hinted_words = '{}' - """, telegram_id, score, current_level) + hinted_words = '{}', + words_collected = COALESCE(bubble_words_progress.words_collected, 0) + $4, + no_hints_streak = CASE WHEN $5 = 1 + THEN COALESCE(bubble_words_progress.no_hints_streak, 0) + 1 ELSE 0 END, + perfect_streak = CASE WHEN $6 = 1 + THEN COALESCE(bubble_words_progress.perfect_streak, 0) + 1 ELSE 0 END + """, telegram_id, score, current_level, words_count, no_hints_clean, perfect_clean) + + # πŸ”§ ΠΠžΠ’ΠžΠ• (15.10.2026): Ρ‡ΠΈΡ‚Π°Π΅ΠΌ Π°ΠΊΡ‚ΡƒΠ°Π»ΡŒΠ½Ρ‹Π΅ счётчики для ΠΏΡ€ΠΎΠ²Π΅Ρ€ΠΊΠΈ достиТСний. + stats = await conn.fetchrow(""" + SELECT words_collected, no_hints_streak, perfect_streak, total_score + FROM bubble_words_progress WHERE user_id = $1 + """, telegram_id) + words_collected = stats["words_collected"] or 0 + no_hints_streak = stats["no_hints_streak"] or 0 + perfect_streak = stats["perfect_streak"] or 0 + bubble_total_score = stats["total_score"] or 0 # Π”Π°Π½Π½Ρ‹Π΅ для достиТСний total_levels = await conn.fetchval(