diff --git a/routers/bubblewords.py b/routers/bubblewords.py index c2c4750..5de2a28 100644 --- a/routers/bubblewords.py +++ b/routers/bubblewords.py @@ -163,6 +163,28 @@ async def get_next_bubble_level(request: Request): random.shuffle(all_parts) + # 🔧 НОВОЕ (14.10.2026): сохраняем состояние уровня для подсказок + # и сбрасываем счётчики подсказок/списка при новом уровне. + level_state = [ + { + "word_pl": w["word_pl"], + "translation": w["translation"], + "parts": w["parts"], + } + for w in result_words + ] + 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, 0, 0, $2, 0, 0, $3::jsonb, '{}') + ON CONFLICT (user_id) DO UPDATE + SET current_hints_used = 0, + current_list_opened = 0, + current_level_words = $3::jsonb, + hinted_words = '{}' + """, telegram_id, current_level, json.dumps(level_state)) + return { "words": result_words, "bubbles": all_parts,