Skip to content

Radio with custom integer values is not graded properly on correct answer #135

@MikaelSiidorow

Description

@MikaelSiidorow

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

def grade_radio(self, configuration, value, hints=None):
hints = hints or []
# There may be several correct options, but only one of them needs to
# be selected in the submission in order to gain points.
correct = False
i = 0
for opt in configuration.get("options", []):
name = self.option_name(i, opt)
if opt.get("correct", False):
if name == value:
correct = True
else:
self.append_hint(hints, opt)
elif name == value:
self.append_hint(hints, opt)
i += 1
return correct, hints, 'string'

Where on line 752 the if name == value is performing a str to int comparison, so it is always false.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: configRelated to course configurationarea: grading quizzesQuiz featureeffort: hoursThe issue seems to be small and should be doable in hours or few days.experience: beginnerrequired knowledge estimaterequester: Aalto teacherThe issue is raised by a teacher from Aalto Universitystatus: requires a priorityusing this label to flag that need EDIT decision ASAPtype: bugThis is a bug.

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions