Commit ccfa559c by Will Daly

Bugfix: validate duplicate point values for rubrics with example-based assessments

parent 357113c4
...@@ -321,6 +321,7 @@ class ValidationIntegrationTest(TestCase): ...@@ -321,6 +321,7 @@ class ValidationIntegrationTest(TestCase):
# for a particular criterion. # for a particular criterion.
# This should cause a validation error with example-based assessment. # This should cause a validation error with example-based assessment.
mutated_rubric = copy.deepcopy(self.RUBRIC) mutated_rubric = copy.deepcopy(self.RUBRIC)
mutated_rubric['criteria'][0]['options'] = copy.deepcopy(self.CRITERION_OPTIONS)
for option in mutated_rubric['criteria'][0]['options']: for option in mutated_rubric['criteria'][0]['options']:
option['points'] = 1 option['points'] = 1
......
...@@ -186,14 +186,14 @@ def validate_rubric(rubric_dict, current_rubric, is_released, is_example_based): ...@@ -186,14 +186,14 @@ def validate_rubric(rubric_dict, current_rubric, is_released, is_example_based):
) )
return (False, msg) return (False, msg)
# Example-based assessments impose the additional restriction # Example-based assessments impose the additional restriction
# that the point values for options must be unique within # that the point values for options must be unique within
# a particular rubric criterion. # a particular rubric criterion.
if is_example_based: if is_example_based:
duplicates = _duplicates([option['points'] for option in criterion['options']]) duplicates = _duplicates([option['points'] for option in criterion['options']])
if len(duplicates) > 0: if len(duplicates) > 0:
msg = _(u"Example-based assessments cannot have duplicate point values.") msg = _(u"Example-based assessments cannot have duplicate point values.")
return (False, msg) return (False, msg)
# After a problem is released, authors are allowed to change text, # After a problem is released, authors are allowed to change text,
# but nothing that would change the point value of a rubric. # but nothing that would change the point value of a rubric.
......
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