Exemplo n.º 1
0
def create_last_question(qno, course_id):
    if request.method == "POST":
        data = request.form
        # print(data)
        flag_for_all = service.check_is_all_field_fill_up(data)
        if flag_for_all == -1:
            flash('Please fill up all fields.')
            return redirect('/re_create_question/' + str(course_id) + '/' +
                            str(qno))
        quiz = Quiz.QuizBuilder(data['question']) \
            .with_option1(data['option1']) \
            .with_option2(data['option2']) \
            .with_option3(data['option3']) \
            .with_option4(data['option4']) \
            .with_currect_answer(data['radioName']) \
            .build()
        global global_quiz
        global_quiz = ConcreteCodiment(global_quiz, quiz)
        service.save_quiz_to_databse(global_quiz, course_id)
        qno = int(qno)
        qno += 1
        # print(qno)
        # print(course_id)
    return render_template(
        'OnlineClassroom/post_and_comment/successfully_quiz_created.html',
        **locals())
Exemplo n.º 2
0
def create_last_question(qno,course_id):
    if request.method=="POST":
        data = request.form
        print(data)
        quiz = Quiz.QuizBuilder(data['question']) \
            .with_option1(data['option1']) \
            .with_option2(data['option2']) \
            .with_option3(data['option3']) \
            .with_option4(data['option4']) \
            .with_currect_answer(data['radioName']) \
            .build()
        global global_quiz
        global_quiz = ConcreteCodiment(global_quiz, quiz)
        service.save_quiz_to_databse(global_quiz, course_id)
    qno=int(qno)
    qno+=1
    print(qno)
    print(course_id)
    return render_template('OnlineClassroom/post_and_comment/successfully_quiz_created.html',**locals())