feat: restructure menu and add file import
- Consolidate "Add word" menu with submenu (Manual, Thematic, Import) - Add file import support (.txt, .md) with AI batch translation - Add vocabulary pagination with navigation buttons - Add "Add word" button in tasks for new words mode - Fix undefined variables bug in vocabulary confirm handler - Add localization keys for add_menu in ru/en/ja 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -90,14 +90,21 @@ class VocabularyService:
|
||||
return [w for w in words if not VocabularyService._is_japanese(w.word_original)]
|
||||
|
||||
@staticmethod
|
||||
async def get_user_words(session: AsyncSession, user_id: int, limit: int = 50, learning_lang: Optional[str] = None) -> List[Vocabulary]:
|
||||
async def get_user_words(
|
||||
session: AsyncSession,
|
||||
user_id: int,
|
||||
limit: int = 50,
|
||||
offset: int = 0,
|
||||
learning_lang: Optional[str] = None
|
||||
) -> List[Vocabulary]:
|
||||
"""
|
||||
Получить все слова пользователя
|
||||
Получить слова пользователя с пагинацией
|
||||
|
||||
Args:
|
||||
session: Сессия базы данных
|
||||
user_id: ID пользователя
|
||||
limit: Максимальное количество слов
|
||||
offset: Смещение для пагинации
|
||||
|
||||
Returns:
|
||||
Список слов пользователя
|
||||
@@ -109,7 +116,7 @@ class VocabularyService:
|
||||
)
|
||||
words = list(result.scalars().all())
|
||||
words = VocabularyService._filter_by_learning_lang(words, learning_lang)
|
||||
return words[:limit]
|
||||
return words[offset:offset + limit]
|
||||
|
||||
@staticmethod
|
||||
async def get_words_count(session: AsyncSession, user_id: int, learning_lang: Optional[str] = None) -> int:
|
||||
|
||||
Reference in New Issue
Block a user