From 9d7f779f0722c33d45522c2f671e3d0060f7520c Mon Sep 17 00:00:00 2001 From: Bertrand Benjamin Date: Wed, 4 May 2022 17:04:16 +0200 Subject: [PATCH] Fix: Fix planer when students_csv is empty --- bopytex/planner/generate_compile_join_planner.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bopytex/planner/generate_compile_join_planner.py b/bopytex/planner/generate_compile_join_planner.py index 28e30cb..8fd2ad2 100644 --- a/bopytex/planner/generate_compile_join_planner.py +++ b/bopytex/planner/generate_compile_join_planner.py @@ -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)