Exemplo n.º 1
0
 def factory_form_json(cls, quiz_json):
     if quiz_json is None:
         raise NoSuchQuizExistException()
     questions = []
     if quiz_json['questions'] is not None:
         for question in quiz_json['questions']:
             questions.append(QuizQuestion.factory_form_json(question))
         
     quiz_obj = cls(quiz_json['title'], questions, int(quiz_json['points']),  quiz_json['_id'])
     return quiz_obj
Exemplo n.º 2
0
    def factory_form_json(cls, quiz_json):
        if quiz_json is None:
            raise NoSuchQuizExistException()
        questions = []
        if quiz_json['questions'] is not None:
            for question in quiz_json['questions']:
                questions.append(QuizQuestion.factory_form_json(question))

        quiz_obj = cls(quiz_json['title'], questions, int(quiz_json['points']),
                       quiz_json['_id'])
        return quiz_obj
Exemplo n.º 3
0
 def get_by_user(cls, user_id):
     quiz_question = Database.find_one(QuizQuestion.COLLECTION, {'user_id': user_id})
     return QuizQuestion.factory_form_json(quiz_question)
Exemplo n.º 4
0
 def get_by_user(cls, user_id):
     quiz_question = Database.find_one(QuizQuestion.COLLECTION,
                                       {'user_id': user_id})
     return QuizQuestion.factory_form_json(quiz_question)