Пример #1
0
def practice_by_category(category: str):
    """Displays all words belonging to some grammatical category.

    Randomizes word order by default.
    """
    return make_flashcard_run(
        endpoint=".practice",
        query=Word.query.filter_by(category=GrammaticalCategory(category)),
        sorting=FlashcardSorting.SHUFFLE,
    )
Пример #2
0
def practice_all():
    """Displays every word.
    
    Randomizes word order by default.
    """
    return make_flashcard_run(
        endpoint=".practice",
        query=Word.query,
        sorting=FlashcardSorting.SHUFFLE,
    )
Пример #3
0
def practice_all_favorites():
    """Displays all favorited words.

    Randomizes word order by default.
    """
    return make_flashcard_run(
        endpoint=".practice",
        query=Word.query.filter_by(favorite=True),
        sorting=FlashcardSorting.SHUFFLE,
    )
Пример #4
0
def review_by_category(category: str):
    """Displays all words belonging to some grammatical category.

    Do not randomize by default.
    """
    return make_flashcard_run(
        endpoint=".review",
        query=Word.query.filter_by(category=GrammaticalCategory(category)),
        sorting=FlashcardSorting.ALPHABETICAL,
    )
Пример #5
0
def review_all_favorites():
    """Displays all favorited words.

    Do not randomize by default.
    """
    return make_flashcard_run(
        endpoint=".review",
        query=Word.query.filter_by(favorite=True),
        sorting=FlashcardSorting.ALPHABETICAL,
    )
Пример #6
0
def review_all():
    """Displays every word.
    
    Do not randomize by default.
    """
    return make_flashcard_run(
        endpoint=".review",
        query=Word.query,
        sorting=FlashcardSorting.ALPHABETICAL,
    )
Пример #7
0
def review_by_word(word_id: str):
    """Display every word but start at the word with the requisite ID.

    Do not randomize by default.
    """
    return make_flashcard_run(
        endpoint=".review",
        query=Word.query,
        sorting=FlashcardSorting.ALPHABETICAL,
        start_at_word_id=int(word_id),
    )
Пример #8
0
def review_by_chapter(chapter_id: str):
    """Fetches all words from a chapter, shuffles them, and displays
    them.

    Do not randomize by default.
    """
    return make_flashcard_run(
        endpoint=".review",
        query=Word.query.filter_by(chapter=int(chapter_id)),
        sorting=FlashcardSorting.ALPHABETICAL,
    )
Пример #9
0
def practice_by_chapter(chapter_id: str):
    """Fetches all words from a chapter, shuffles them, and displays
    them.

    Randomizes word order by default.
    """
    return make_flashcard_run(
        endpoint=".practice",
        query=Word.query.filter_by(chapter=int(chapter_id)),
        sorting=FlashcardSorting.SHUFFLE,
    )