Fix hints bug in questionnaire: mixing list and dict syntax
markkuriekkinen opened this issue · 3 comments
The hints
variable in grade_field
looks suspicious. Some lines use it like a list and some lines like a dict. My first impression is that it should be a list.
This line crashes for me:
mooc-grader/access/types/forms.py
Line 639 in 50d1e2a
File "/srv/grader/access/types/forms.py", line 639, in grade_field
hints['multiple'] = _('Multiple choices are selectable')
TypeError: list indices must be integers or slices, not str
Is it enough to change the dict syntax to the list append method?
This crash occurs in the arithmetic quiz in the test-course (indexyaml branch): https://github.com/apluslms/test-course/blob/6b19b9e1a6c523516812950ae7c3ae499e828bc2/exercises/arithmetic.yaml
This changed the datatype of the
hints
, which makes the code a bit messy, i.e., it type isn't consistent in different locations of the code. Would it be possible to always convert the list of hints to a OrderedDict? (hints = OrderedDict.from_keys(hints)
)
Originally posted by @raphendyr in #76 (comment)