feat: мини-игры, premium подписка, улучшенные контексты
Мини-игры (/games): - Speed Round: 10 раундов, 10 секунд на ответ, очки за скорость - Match Pairs: 5 слов + 5 переводов, соединить пары Premium-функции: - Поля is_premium и premium_until для пользователей - AI режим проверки ответов (учитывает синонимы) - Batch проверка всех ответов одним запросом Улучшения: - Примеры использования для всех добавляемых слов - Разбиение переводов по запятой на отдельные записи - Полные предложения в контекстах (без ___) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -198,7 +198,7 @@ async def import_single_word(callback: CallbackQuery, state: FSMContext):
|
||||
# Добавляем слово
|
||||
translation_lang = get_user_translation_lang(user)
|
||||
|
||||
await VocabularyService.add_word(
|
||||
new_word = await VocabularyService.add_word(
|
||||
session=session,
|
||||
user_id=user_id,
|
||||
word_original=word_data['word'],
|
||||
@@ -210,6 +210,16 @@ async def import_single_word(callback: CallbackQuery, state: FSMContext):
|
||||
source=WordSource.CONTEXT
|
||||
)
|
||||
|
||||
# Добавляем переводы в word_translations (разбиваем по запятой)
|
||||
await VocabularyService.add_translation_split(
|
||||
session=session,
|
||||
vocabulary_id=new_word.id,
|
||||
translation=word_data['translation'],
|
||||
context=word_data.get('example') or word_data.get('context'),
|
||||
context_translation=word_data.get('example_translation') or word_data.get('context_translation'),
|
||||
is_primary=True
|
||||
)
|
||||
|
||||
lang = (user.language_interface if user else 'ru') or 'ru'
|
||||
await callback.message.answer(t(lang, 'import.added_single', word=word_data['word']))
|
||||
|
||||
@@ -241,7 +251,7 @@ async def import_all_words(callback: CallbackQuery, state: FSMContext):
|
||||
# Добавляем слово
|
||||
translation_lang = get_user_translation_lang(user)
|
||||
|
||||
await VocabularyService.add_word(
|
||||
new_word = await VocabularyService.add_word(
|
||||
session=session,
|
||||
user_id=user_id,
|
||||
word_original=word_data['word'],
|
||||
@@ -252,6 +262,16 @@ async def import_all_words(callback: CallbackQuery, state: FSMContext):
|
||||
difficulty_level=data.get('level'),
|
||||
source=WordSource.CONTEXT
|
||||
)
|
||||
|
||||
# Добавляем переводы в word_translations (разбиваем по запятой)
|
||||
await VocabularyService.add_translation_split(
|
||||
session=session,
|
||||
vocabulary_id=new_word.id,
|
||||
translation=word_data['translation'],
|
||||
context=word_data.get('example') or word_data.get('context'),
|
||||
context_translation=word_data.get('example_translation') or word_data.get('context_translation'),
|
||||
is_primary=True
|
||||
)
|
||||
added_count += 1
|
||||
|
||||
lang = (user.language_interface if user else 'ru') or 'ru'
|
||||
@@ -478,7 +498,7 @@ async def import_file_all_words(callback: CallbackQuery, state: FSMContext):
|
||||
continue
|
||||
|
||||
# Добавляем слово
|
||||
await VocabularyService.add_word(
|
||||
new_word = await VocabularyService.add_word(
|
||||
session=session,
|
||||
user_id=user_id,
|
||||
word_original=word_data['word'],
|
||||
@@ -488,6 +508,18 @@ async def import_file_all_words(callback: CallbackQuery, state: FSMContext):
|
||||
transcription=word_data.get('transcription'),
|
||||
source=WordSource.IMPORT
|
||||
)
|
||||
|
||||
# Добавляем переводы в word_translations (разбиваем по запятой)
|
||||
translation = word_data.get('translation', '')
|
||||
if translation:
|
||||
await VocabularyService.add_translation_split(
|
||||
session=session,
|
||||
vocabulary_id=new_word.id,
|
||||
translation=translation,
|
||||
context=word_data.get('example'),
|
||||
context_translation=word_data.get('example_translation'),
|
||||
is_primary=True
|
||||
)
|
||||
added_count += 1
|
||||
|
||||
lang = get_user_lang(user)
|
||||
|
||||
Reference in New Issue
Block a user