apluslms/mooc-grader

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:

hints['multiple'] = _('Multiple choices are selectable')

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 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)