Exemplo n.º 1
0
    def run(self):
        while True:
            try:
                question = Question.select().where(Question.processed == False).get()
                question.mark_as_processed()
                logging.info("Processing question '%s'" % question)
            except Question.DoesNotExist as e:
                break

            answers = self.answers_factory.get(question)
            if not answers:
                logging.error("No answers found for question '%s'" % question)
                continue
            for answer in answers:
                answer.save()
            logging.info("Question '%s' processed." % question)
        logging.info("All questions processed.")
Exemplo n.º 2
0
 def setup_class(self):
     self.question = Question.get_random()
     self.answers = list(self.question.answers)
     self.answer_evaluator = AnswerEvaluator()