Ejemplo n.º 1
0
    def save():
        try:
            questionid = int(request.values['questionid'])
            question = Question.by_id(questionid)
            text = request.values['text']
            userid = g.lti.get_user_id()
        except:
            return abort(404)

        if AnswerModel.question_valid(questionid) and text != "":
            AnswerModel.save(questionid, userid, text)

        return redirect('/index_student')
Ejemplo n.º 2
0
 def render(self):
     try:
         questionid = int(request.values['questionid'])
         answerid1 = int(request.values['answerid1'])
         answerid2 = int(request.values['answerid2'])
     except:
         return abort(404)
         
     try:
         question = Question.by_id(questionid)
         answer1 = AnswerModel.by_id(answerid1)
         answer2 = AnswerModel.by_id(answerid2)
     except:
         return abort(404)
         
     if AnswerModel.question_valid(questionid):
         return render_template('choice.html',
                                question = question,
                                answer1 = answer1,
                                answer2 = answer2)
     else:
         return redirect('/choicelobby?question_id=' + questionid)