Foreign app ORM queries¶
Translate word exercise lookup parameters¶
Database query module for Foreign word translation exercises.
- class WordLookupParams(lookup_conditions: dict)¶
Bases:
LookupParams
Lookup parameters class.
- Parameters:
lookup_conditions (dict) – The user exercise conditions.
Examples¶
lookup_params = LookupParams(lookup_conditions) params: tuple[Q, ...] = lookup_params.params query = Model.objects.filter(*params)
- property params: tuple[Q, ...]¶
Lookup parameters (tuple[Q, …], read-only).
- property favorites: Q¶
Lookup parameter by favorite status (Q, read-only).
- property progress: Q¶
Lookup parameter by user assessment (Q, read-only).
Favorite word¶
The module of favorite words orm_queries using Django ORM.
- is_word_in_favorites(user_id: int | str, word_id: int | str) bool ¶
Find out if the word is the favorites.
- update_word_favorites_status(word_id: int | str, user_id: int | str) bool ¶
Update the favorite status of the word.
Word study progress¶
A module for user word assessment knowledge accounting.
Accounting of the level of knowledge of words in the application.
The module contains functions for querying the database for adding, updating and retrieving the level of knowledge of words assessed by the user. The knowledge assessment has a limited range containing intervals. Each interval is used by the selection of words for display on the page of the user of the application. Each user has his own assessments of words, given by him and available only to him. The application contains the following intervals: study, repetition, verification, know.
- get_progress(word_id: int, user_id: int) int ¶
Get or create a user rating of word knowledge.
Get or create a user rating of word knowledge in the database. When creating a rating, the rating is set to “0”.
- update_progress(word_pk: int, user_pk: int, new_assessment: int) None ¶
Update the user’s word knowledge score.
Update the user’s word knowledge score in the database, within the acceptable range.
- get_numeric_value(progress: str) list[int] ¶
Convert a string representation of a knowledge level.
Convert a string representation of a knowledge level into a range of numbers for that level.