def insert_frenchword_answer(username, guess_word): username = User.query.filter_by(username=username).first_or_404() user_id = current_user.get_id() user_status = check_teacher_student(user_id) form = InsertWordForm() if form.validate_on_submit(): user_answer = form.word.data decision, true_word = insert_frenchword_training( username, guess_word, user_answer) return render_template('exercises/insert_frenchword_answer.html', true_word=true_word, decision=decision, user_status=user_status)
def insert_frenchword(username): username = User.query.filter_by(username=username).first_or_404() user_id = current_user.get_id() user_status = check_teacher_student(user_id) new_words = list( filter(lambda x: x[1] == 'new' and x[7] is not None, process_user_frenchdict_index(username))) new_words_number = len(new_words) form = InsertWordForm() if new_words_number: guess_word = choice(new_words) return render_template('exercises/insert_frenchword.html', guess_word=guess_word[0].translation_rus, new_words_number=new_words_number, form=form, user_status=user_status) return render_template('exercises/insert_frenchword.html', user_status=user_status)