From 5810eccde1a1eb4d755c241bf79f03e700da951c Mon Sep 17 00:00:00 2001 From: Drobysh Date: Fri, 16 Oct 2026 11:58:53 +0000 Subject: [PATCH] =?UTF-8?q?[Eva]=20B5.2:=20init=5Fsentences=20=E2=80=94=20?= =?UTF-8?q?=D0=B5=D0=B4=D0=B8=D0=BD=D1=8B=D0=B9=20=D0=BF=D1=83=D0=BB,=20?= =?UTF-8?q?=D1=81=D0=BA=D0=B2=D0=BE=D0=B7=D0=BD=D0=B0=D1=8F=20=D0=BD=D1=83?= =?UTF-8?q?=D0=BC=D0=B5=D1=80=D0=B0=D1=86=D0=B8=D1=8F=201..400?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/sentences.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/routers/sentences.py b/routers/sentences.py index 9511304..871ba29 100644 --- a/routers/sentences.py +++ b/routers/sentences.py @@ -65,6 +65,7 @@ async def init_sentences(): ("B1", "sentences_b1.csv"), ] + offset = 0 for level, filename in level_files: sentences = load_sentences_from_csv(filename) for i, s in enumerate(sentences): @@ -74,11 +75,12 @@ async def init_sentences(): await conn.execute( """INSERT INTO sentences (sentence_number, sentence_pl, translation_ru, translation_uk, translation_en, difficulty, level) VALUES ($1, $2, $3, $4, $5, $6, $7) - ON CONFLICT (level, sentence_number) DO NOTHING""", - i + 1, s["sentence_pl"], + ON CONFLICT (sentence_number) DO NOTHING""", + offset + i + 1, s["sentence_pl"], s["translation_ru"], s["translation_uk"], s["translation_en"], difficulty, level ) + offset += len(sentences) def normalize_word_for_display(word: str) -> str: