diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-08-29 14:21:45 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2023-08-29 14:21:45 +0200 |
| commit | 25b247c5122bdc9ac166b89c2f558b894168b960 (patch) | |
| tree | ca19db9cc8b6664f975de8bd4a9d21c2b6cae5a1 | |
| parent | b09adb8dbe0bcf97b28a8b8eabf34e7438fc8fe1 (diff) | |
| download | unterricht-25b247c5122bdc9ac166b89c2f558b894168b960.tar.gz unterricht-25b247c5122bdc9ac166b89c2f558b894168b960.zip | |
support form which multiple lehrplan specificity
| -rwxr-xr-x | scripts/gen_map/gen_map.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/scripts/gen_map/gen_map.py b/scripts/gen_map/gen_map.py index 75aa7a48..9660565d 100755 --- a/scripts/gen_map/gen_map.py +++ b/scripts/gen_map/gen_map.py @@ -166,10 +166,12 @@ def parse_section_html(section, summary_class: str) -> t.Tuple[str, str, int]: return num, summary, duration -def get_lehrplan(subject: str, form: str) -> Lehrplan: +def get_lehrplan(subject: str, form: str, form_type: str) -> Lehrplan: """Retrieve the sections and expected duration from lehrplanplus""" lpp_url = '/'.join([LPP_BASE_URL, form, subject]) + if form_type: + lpp_url += f'/{form_type}' resp = requests.get(lpp_url, timeout=10) html = BeautifulSoup(resp.text) @@ -292,8 +294,12 @@ def print_map(rows: list[str], template_path: Path, outfile): def main(): """Create a rough map template for a certain school year""" parser = argparse.ArgumentParser() - parser.add_argument('subject', type=str) + parser.add_argument('subject') parser.add_argument('form', type=int) + parser.add_argument( + '--form-type', + help='type of the form used by LPP', + ) parser.add_argument('--template-dir') parser.add_argument('--year', default=default_year()) parser.add_argument('--land', default=BAYERN) @@ -307,7 +313,9 @@ def main(): school_holidays[-1].start) weekly_hours = WEEKLY_HOURS[args.subject][args.form] - lehrplan = get_lehrplan(args.subject, str(args.form)) + lehrplan = get_lehrplan(args.subject, str(args.form), args.form_type) + if not lehrplan: + print('WARNING: empty lehrplan', file=sys.stderr) rows = gen_latex_table(weekly_hours, lehrplan, school_holidays, public_holidays, args.inter_section_buffer) |
