Commit 4219e1af by Martyn James Committed by Jonathan Piacenti

Protect against divide by zero when course has no scores

parent b959469a
......@@ -198,7 +198,7 @@ def calculate_proforma_grade(grade_summary, grading_policy):
categories_to_estimate.append(category)
else:
categories_to_estimate.append(category)
assumed_category_average = sum(category_averages) / len(category_averages)
assumed_category_average = sum(category_averages) / len(category_averages) if len(category_averages) > 0 else 0
for category in categories_to_estimate:
category_policy = next((policy for policy in grading_policy['GRADER'] if policy['type'] == category), None)
category_weight = category_policy['weight']
......
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