Commit b7e0bce364b14f78fb80586db25939fab52726e5

Authored by Miguel Barão
1 parent b5a62c5c
Exists in master and in 1 other branch dev

- fixed mathjax link

Showing 2 changed files with 7 additions and 5 deletions   Show diff stats
questions.py
... ... @@ -8,7 +8,7 @@
8 8 #
9 9 # # read question from file
10 10 # qdict = tools.load_yaml(filename)
11   -# qfactory = QFactory(question)
  11 +# qfactory = QFactory(qdict)
12 12 # question = qfactory.generate()
13 13 #
14 14 # # experiment answering one question and correct it
... ... @@ -102,7 +102,7 @@ class QuestionRadio(Question):
102 102 # set defaults if missing
103 103 self.set_defaults({
104 104 'text': '',
105   - 'correct': 0,
  105 + 'correct': 0.0,
106 106 'shuffle': True,
107 107 'discount': True,
108 108 })
... ... @@ -234,6 +234,7 @@ class QuestionText(Question):
234 234 super().correct(answer)
235 235  
236 236 if self['answer']:
  237 + # FIXME in self['answer'][0] why [0]???
237 238 self['grade'] = 1.0 if self['answer'][0] in self['correct'] else 0.0
238 239  
239 240 return self['grade']
... ... @@ -263,6 +264,7 @@ class QuestionTextRegex(Question):
263 264 super().correct(answer)
264 265 if self['answer']:
265 266 try:
  267 + # FIXME why [0]?
266 268 self['grade'] = 1.0 if re.match(self['correct'], self['answer'][0]) else 0.0
267 269 except TypeError:
268 270 logger.error('While matching regex {0} with answer {1}.'.format(self['correct'], self['answer'][0]))
... ... @@ -298,7 +300,7 @@ class QuestionTextNumeric(Question):
298 300 try:
299 301 self['grade'] = 1.0 if lower <= float(self['answer'][0]) <= upper else 0.0
300 302 except TypeError:
301   - logger.error('While matching regex {0} with answer {1}.'.format(self['correct'], self['answer'][0]))
  303 + logger.error('While matching regex {0} with answer {1}.'.format(self['correct'], self['answer'][0])) # FIXME [0], regex???
302 304 except ValueError:
303 305 self['comments'] = f'A resposta "{self["answer"][0]}" não é numérica.'
304 306 return self['grade']
... ... @@ -337,7 +339,7 @@ class QuestionTextArea(Question):
337 339 # correct answer
338 340 out = run_script(
339 341 script=self['correct'],
340   - stdin=self['answer'][0],
  342 + stdin=self['answer'][0],# FIXME [0]
341 343 timeout=self['timeout']
342 344 )
343 345 if type(out) in (int, float):
... ...
static/mathjax
1   -../../perguntations/static/mathjax-2.7/
2 1 \ No newline at end of file
  2 +../../perguntations/static/MathJax
3 3 \ No newline at end of file
... ...