diff --git a/questions.py b/questions.py index 78498a6..3e2e6b7 100644 --- a/questions.py +++ b/questions.py @@ -8,7 +8,7 @@ # # # read question from file # qdict = tools.load_yaml(filename) -# qfactory = QFactory(question) +# qfactory = QFactory(qdict) # question = qfactory.generate() # # # experiment answering one question and correct it @@ -102,7 +102,7 @@ class QuestionRadio(Question): # set defaults if missing self.set_defaults({ 'text': '', - 'correct': 0, + 'correct': 0.0, 'shuffle': True, 'discount': True, }) @@ -234,6 +234,7 @@ class QuestionText(Question): super().correct(answer) if self['answer']: + # FIXME in self['answer'][0] why [0]??? self['grade'] = 1.0 if self['answer'][0] in self['correct'] else 0.0 return self['grade'] @@ -263,6 +264,7 @@ class QuestionTextRegex(Question): super().correct(answer) if self['answer']: try: + # FIXME why [0]? self['grade'] = 1.0 if re.match(self['correct'], self['answer'][0]) else 0.0 except TypeError: logger.error('While matching regex {0} with answer {1}.'.format(self['correct'], self['answer'][0])) @@ -298,7 +300,7 @@ class QuestionTextNumeric(Question): try: self['grade'] = 1.0 if lower <= float(self['answer'][0]) <= upper else 0.0 except TypeError: - logger.error('While matching regex {0} with answer {1}.'.format(self['correct'], self['answer'][0])) + logger.error('While matching regex {0} with answer {1}.'.format(self['correct'], self['answer'][0])) # FIXME [0], regex??? except ValueError: self['comments'] = f'A resposta "{self["answer"][0]}" não é numérica.' return self['grade'] @@ -337,7 +339,7 @@ class QuestionTextArea(Question): # correct answer out = run_script( script=self['correct'], - stdin=self['answer'][0], + stdin=self['answer'][0],# FIXME [0] timeout=self['timeout'] ) if type(out) in (int, float): diff --git a/static/mathjax b/static/mathjax index 2bf521d..6fea3a3 120000 --- a/static/mathjax +++ b/static/mathjax @@ -1 +1 @@ -../../perguntations/static/mathjax-2.7/ \ No newline at end of file +../../perguntations/static/MathJax \ No newline at end of file -- libgit2 0.21.2