From d5c7c669d68ba764d09bdf3caf94b9dd97bb9f25 Mon Sep 17 00:00:00 2001 From: Johannes Date: Fri, 6 Oct 2023 18:44:03 +0200 Subject: [PATCH] yes/no question stats --- parse.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/parse.py b/parse.py index 634174c..ae75677 100644 --- a/parse.py +++ b/parse.py @@ -16,6 +16,14 @@ RAHMERST_ID = 308 RAHMZWEIT_ID = 317 # Yummy! ESSEN_ID = 302 +# diverse checkboxes +BOOLEAN_IDS = ( + 304, # Deutschlandticket + 307, # Erstkomatikerin + 310, # Workshop-Themen + 301, # Mörderspiel + 311, # nur Rufname auf Badge +) def parse(filename: Union[str, Path]) -> Tuple[ @@ -52,7 +60,6 @@ def parse(filename: Union[str, Path]) -> Tuple[ quest_answers[quest_id][answer_key] = ( quest_answers[quest_id].get(answer_key, 0) + 1 ) - return items, count_items, questions, quest_answers @@ -81,7 +88,7 @@ def wiki_stats(items: Dict[int, str], count_items: Dict[int, int], questions: Di ret += "|}\n\n" ret += ('== Rahmenprogramm ==\n' - '=== Erstwahlen ===' + '=== Erstwahlen ===\n' '{|class="wikitable sortable"\n' '! Programmpunkt !! gewählt\n' '|-\n') @@ -111,6 +118,17 @@ def wiki_stats(items: Dict[int, str], count_items: Dict[int, int], questions: Di ret += f"*
{wish[1]}
\n" ret += "\n" + ret += ('== Ja/Nein-Abfragen ==\n' + '{|class="wikitable sortable"\n' + '! Frage !! Antwort !! Anzahl\n' + '|-\n') + for field in BOOLEAN_IDS: + for answer, count in quest_answers[field].items(): + if answer[1] in ("False", ""): + continue + ret += f"|| {questions[field]}: || {answer[1]} || {count}\n|-\n" + ret += "|}\n\n" + def prefix(id_): return "Mensch sagt:" if id_ == HUMAN_ID else "Maskottchen sagt:" if id_ == MASCOT_ID else "" ret += ('== Wie heißt das Ding? ==\n'