Beispiel #1
0
def give_mcq(course_id, quiz_id):
    curse=service.get_quiz_data(quiz_id)
    print("in app route")
    print(curse)
    data=curse['questions']
    qno=0
    global global_answer
    global_answer=None
    global_answer=ConcreteBasicGiveQuiz(curse['quiz_name'])
    print(global_answer.question_list)
    return render_template('OnlineClassroom/post_and_comment/give_mcq.html', **locals())
Beispiel #2
0
def next_mcq(quiz_id,qno,course_id,question):
    if request.method=="POST":
        answerdata = request.form
    curse = service.get_quiz_data(quiz_id)
    data=curse['questions']
    qno=int(qno)
    qno+=1
    print('answerdata')
    print(answerdata)
    answer=Answer(question,answerdata['radioName1'])
    global global_answer
    global_answer = ConcreteGiveCodiment(global_answer, answer)
    return render_template('OnlineClassroom/post_and_comment/give_mcq.html', **locals())
Beispiel #3
0
def quiz_result(quiz_id,course_id,question):
    if request.method=="POST":
        answerdata = request.form
    curse = service.get_quiz_data(quiz_id)
    data=curse['questions']
    print('answerdata')
    print(answerdata)
    answer=Answer(question,answerdata['radioName1'])
    global global_answer
    global_answer = ConcreteGiveCodiment(global_answer, answer)
    list=global_answer.add_more_question()
    for answer in list:
        print(answer.get_question(),answer.get_answer())
    score=calculate_score(data,list)
    return render_template('OnlineClassroom/post_and_comment/quiz_result.html',**locals())
Beispiel #4
0
def next_mcq(quiz_id, qno, course_id, question):
    if request.method == "POST":
        answerdata = request.form
        flag_is_answered = service.check_is_answer_selected(answerdata)
        if flag_is_answered == -1:
            flash("Please Choose an Option.")
            return redirect('/re_next_mcq/' + str(quiz_id) + '/' + str(qno) +
                            '/' + str(course_id))
        curse = service.get_quiz_data(quiz_id)
        data = curse['questions']
        qno = int(qno)
        qno += 1
        # print('answerdata')
        # print(answerdata)
        answer = Answer(question, answerdata['radioName1'])
        global global_answer
        global_answer = ConcreteGiveCodiment(global_answer, answer)
    return render_template('OnlineClassroom/post_and_comment/give_mcq.html',
                           **locals())
Beispiel #5
0
def quiz_result(quiz_id, qno, course_id, question):
    if request.method == "POST":
        answerdata = request.form
        flag_is_answered = service.check_is_answer_selected(answerdata)
        if flag_is_answered == -1:
            flash("Please Choose an Option.")
            return redirect('/re_next_mcq/' + str(quiz_id) + '/' + str(qno) +
                            '/' + str(course_id))
        curse = service.get_quiz_data(quiz_id)
        data = curse['questions']
        # print('answerdata')
        # print(answerdata)
        answer = Answer(question, answerdata['radioName1'])
        global global_answer
        global_answer = ConcreteGiveCodiment(global_answer, answer)
        list = global_answer.add_more_question()
        # for answer in list:
        #     print(answer.get_question(),answer.get_answer())
        score = calculate_score(data, list)
    return render_template('OnlineClassroom/post_and_comment/quiz_result.html',
                           **locals())
Beispiel #6
0
def re_next_mcq(quiz_id, qno, course_id):
    curse = service.get_quiz_data(quiz_id)
    qno = int(qno)
    data = curse['questions']
    return render_template('OnlineClassroom/post_and_comment/give_mcq.html',
                           **locals())