From 13fcc8240df04a2089980862d84c386811c19142 Mon Sep 17 00:00:00 2001 From: Drobysh Date: Wed, 14 Oct 2026 09:10:45 +0000 Subject: [PATCH] =?UTF-8?q?[Eva]=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=203=20=D0=BA=D0=BE=D0=BB=D0=BE=D0=BD=D0=BA=D0=B8?= =?UTF-8?q?=20=D0=B2=20bubble=5Fwords=5Fprogress=20(current=5Flist=5Fopene?= =?UTF-8?q?d,=20current=5Flevel=5Fwords,=20hinted=5Fwords)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- database.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/database.py b/database.py index 440708f..73d07d6 100644 --- a/database.py +++ b/database.py @@ -898,6 +898,46 @@ async def init_db(): """) logger.info("Added current_hints_used column to bubble_words_progress") + # 🔧 НОВОЕ (14.10.2026): current_list_opened — серверный счётчик + # «показать слова» для текущего уровня пузырей. Medium — 1 раз. + col_exists = await conn.fetchval(""" + SELECT 1 FROM information_schema.columns + WHERE table_name = 'bubble_words_progress' AND column_name = 'current_list_opened' + """) + if not col_exists: + await conn.execute(""" + ALTER TABLE bubble_words_progress + ADD COLUMN current_list_opened INT DEFAULT 0 + """) + logger.info("Added current_list_opened column to bubble_words_progress") + + # 🔧 НОВОЕ (14.10.2026): current_level_words — состояние текущего + # уровня пузырей (слова + части + переводы). Нужно для подсказок, + # т.к. уровень генерируется на лету в /next и нигде не хранится. + col_exists = await conn.fetchval(""" + SELECT 1 FROM information_schema.columns + WHERE table_name = 'bubble_words_progress' AND column_name = 'current_level_words' + """) + if not col_exists: + await conn.execute(""" + ALTER TABLE bubble_words_progress + ADD COLUMN current_level_words JSONB DEFAULT '[]'::jsonb + """) + logger.info("Added current_level_words column to bubble_words_progress") + + # 🔧 НОВОЕ (14.10.2026): hinted_words — какие слова уже получили + # подсказку «первая часть» (для «каждый раз разное слово»). + col_exists = await conn.fetchval(""" + SELECT 1 FROM information_schema.columns + WHERE table_name = 'bubble_words_progress' AND column_name = 'hinted_words' + """) + if not col_exists: + await conn.execute(""" + ALTER TABLE bubble_words_progress + ADD COLUMN hinted_words TEXT[] DEFAULT '{}' + """) + logger.info("Added hinted_words column to bubble_words_progress") + # ============ wrong_because_explanations ============ await conn.execute(""" CREATE TABLE IF NOT EXISTS wrong_because_explanations (