def remember_frenchword_training(username, guess_word): guess_word = user_frenchdict_search(guess_word, username) word = UsersWords.query.get(guess_word[3]) word.remember_word = None db.session.commit() if word.word_translation is None and word.translation_word is None \ and word.word_write is None and word.translation_write is None: word_status_change_to_familiar(word)
def frenchword_translation_training(username, guess_word, user_answer): guess_word = user_frenchdict_search(guess_word, username) word = UsersWords.query.get(guess_word[3]) if guess_word[0].translation_rus == user_answer: word.word_translation = None db.session.commit() if word.translation_word is None and word.word_write is None \ and word.translation_write is None and word.remember_word is None: word_status_change_to_familiar(word) return 'Верно', guess_word word.word_translation += 1 db.session.commit() return 'Неверно', guess_word
def user_search_frenchword_button(username, word_to_search): username = User.query.filter_by(username=username).first_or_404() title = 'Ваш французский словарь' search_form = FrenchDictionarySearchForm() delete_form = DeleteFrenchWordButton() user_id = current_user.get_id() user_status = check_teacher_student(user_id) word, user_french_word_status, user_french_word_date, userword_id = user_frenchdict_search( word_to_search, username) return render_template('dictionary/user_frenchdict_search.html', page_title=title, french_word=word, french_word_status=user_french_word_status, french_word_date=user_french_word_date, form=search_form, delete_form=delete_form, user=username.username, user_status=user_status)
def user_process_frenchdict_search(username): username = User.query.filter_by(username=username).first_or_404() title = 'Ваш французский словарь' search_form = FrenchDictionarySearchForm() delete_form = DeleteFrenchWordButton() user_id = current_user.get_id() user_status = check_teacher_student(user_id) if search_form.validate_on_submit(): word_in_form, word = search_form.word.data, None session['word'] = search_form.word.data word, user_french_word_status, user_french_word_date, userword_id = user_frenchdict_search( word_in_form, username) if word: return render_template('dictionary/user_frenchdict_search.html', page_title=title, french_word=word, french_word_status=user_french_word_status, french_word_date=user_french_word_date, form=search_form, delete_form=delete_form, user=username.username, user_status=user_status) flash('Такого слова нет в вашем французском словаре') translation = user_frenchdict_translate(word_in_form) if translation: translation_form = WordInsertForm() return render_template('dictionary/user_frenchdict_insert.html', page_title=title, french_word=word_in_form, translation=translation, form=search_form, translation_form=translation_form, user=username.username, user_status=user_status) return redirect( url_for('.user_frenchdict_index', username=username.username))
def not_remember_frenchword_training(username, guess_word): guess_word = user_frenchdict_search(guess_word, username) word = UsersWords.query.get(guess_word[3]) word.remember_word += 1 db.session.commit()