From fd1551202ce073ec307e3eb127d3b6e40488e1a1 Mon Sep 17 00:00:00 2001 From: Dominik Rimpf Date: Sat, 28 Oct 2023 22:32:48 +0200 Subject: [PATCH] fixes --- generate_bmbf_list.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/generate_bmbf_list.py b/generate_bmbf_list.py index 5c8f048..4bf74fd 100644 --- a/generate_bmbf_list.py +++ b/generate_bmbf_list.py @@ -13,7 +13,7 @@ event_period = "27.10. - 31.10.23" event_org = "Verein der Freunde und Förderer der Bundesfachschaftentagung Elektrotechnik e.V." event_name = "93. Bundesfachschaftentagung Elektrotechnik" attendees_csv = "/Users/dominik/Nextcloud BuFaTa ET/Ausschüsse/Generalsekreteriat/93_teilnehmer.csv" -empty_sheets = 2 +empty_sheets = 1 template_form = "Teilnehmendenliste_FR_22_23_final.pdf" date_list = ["27.10.23", "28.10.23", "29.10.23", "30.10.23", "31.10.23"] @@ -35,7 +35,7 @@ def read_csv(csv_path): with csvfile: reader = csv.DictReader(csvfile, delimiter=",") persons = [{"Name": f"{t['Amtlicher Vorname'] if t['Amtlicher Vorname'] else t['Vorname']} {t['Nachname']}", "Hochschule": f"{t['Standort']}"} for t in reader if - t['Status'] == "Student"] + t['Status'] == "Immatrikuliert"] persons.sort(key=itemgetter("Hochschule", "Name")) for idx, p in enumerate(persons): p["Position"] = str(idx + 1) @@ -88,6 +88,9 @@ if __name__ == "__main__": sys.exit(1) person_list = read_csv(csv_file_path) + if not person_list: + print("CSV file was empty") + sys.exit(0) persons_per_page = len(form_mapping) person_list_per_page = [person_list[i:i + persons_per_page] for i in range(0, len(person_list), persons_per_page)]