Fix div by 0

This commit is contained in:
cuom1999 2024-02-19 17:35:36 -06:00
parent fcaf76e89f
commit 6d763f2db5

View file

@ -60,7 +60,7 @@ def calculate_lessons_progress(profile, lessons):
res["total"] = { res["total"] = {
"achieved_points": total_achieved_points, "achieved_points": total_achieved_points,
"total_points": total_points, "total_points": total_points,
"percentage": total_achieved_points / total_points * 100, "percentage": total_achieved_points / total_points * 100 if total_points else 0,
} }
return res return res