Radio with custom integer values is not graded properly on correct answer
MikaelSiidorow opened this issue · 2 comments
If I have a submit exercise with a radio field:
# -- snip --
max_points: 1
view_type: access.types.stdsync.createForm
fieldgroups:
- title: Radio Form
type: radio
required: true
points: 1
options:
- label: Option 1
value: 100
correct: true
- label: Option 2
value: 200
correct: true
All options are correct so I should receive points regardless of which one I pick, but the result is always 0 points.
I believe I've located the cause to the method grade_radio
mooc-grader/access/types/forms.py
Lines 742 to 759 in 5b8b120
Where on line 752 the if name == value
is performing a str to int comparison, so it is always false.
Thanks for the report! If this is about comparing strings to ints, then what if you write values as strings in the assignment config.yaml
file? That is, value: "100"
Thanks for the report! If this is about comparing strings to ints, then what if you write values as strings in the assignment
config.yaml
file? That is,value: "100"
Yeah, this works perfectly and is the workaround we ended up going with, since there was no need for our data to specifically be integers.