Fix: Fix planer when students_csv is empty

This commit is contained in:
Bertrand Benjamin 2022-05-04 17:04:16 +02:00
parent 69b2e1c82e
commit 9d7f779f07

View File

@ -23,11 +23,13 @@ def build_subject_list_from_qty(qty: int) -> list[dict]:
def planner(options: dict) -> list[Task]:
try:
students_csv = options["students_csv"]
assert options["students_csv"] != ""
except KeyError:
except (KeyError, AssertionError):
try:
quantity_subjects = options["quantity_subjects"]
except KeyError:
assert options["quantity_subjects"] != 0
except (KeyError, AssertionError):
raise PlannerMissingOption("students_csv or quantity_subjects is required")
else:
options["subjects"] = build_subject_list_from_qty(qty=quantity_subjects)