Commit ff2ee77c by Will Daly

Fix 500 error on progress page with rubric that has 0 points

parent 90e542d2
......@@ -73,5 +73,6 @@ class LmsCompatibilityMixin(object):
"""
return sum(
max(option["points"] for option in criterion["options"])
if len(criterion["options"]) > 0 else 0
for criterion in self.rubric_criteria
)
<openassessment>
<title>Feedback only criterion</title>
<prompt>Test prompt</prompt>
<rubric>
<prompt>Test rubric prompt</prompt>
<criterion feedback="required">
<name>𝖋𝖊𝖊𝖉𝖇𝖆𝖈𝖐 𝖔𝖓𝖑𝖞</name>
<prompt>This criterion accepts only written feedback, so it has no options</prompt>
</criterion>
</rubric>
<assessments>
<assessment name="self-assessment" />
</assessments>
</openassessment>
......@@ -18,3 +18,7 @@ class LmsMixinTest(XBlockHandlerTestCase):
@scenario('data/basic_scenario.xml')
def test_max_score(self, xblock):
self.assertEqual(xblock.max_score(), 20)
@scenario('data/zero_points.xml')
def test_max_score_zero_option_criteria(self, xblock):
self.assertEqual(xblock.max_score(), 0)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment