Merged in fix/handle-none-lus (pull request #305)

Ignore learning units that are none
This commit is contained in:
Christian Cueni 2024-03-19 06:09:57 +00:00
commit fd123f3377
1 changed files with 9 additions and 1 deletions

View File

@ -51,10 +51,18 @@ def competences(
page_id: Page.objects.get(id=page_id).specific.learning_unit
for page_id in unique_page_ids
}
circles = {lu.id: lu.get_circle() for lu in learning_units.values()}
circles = {
lu.id: c
for lu in learning_units.values()
if lu is not None and (c := lu.get_circle()) is not None
}
for completion in completions:
learning_unit = learning_units.get(completion.page.id)
if not learning_unit:
continue
circle = circles.get(learning_unit.id)
combined_id = f"{circle.id}-{completion.course_session.id}"