diff --git a/main.py b/main.py old mode 100644 new mode 100755 diff --git a/parse.py b/parse.py index 01483a1..039220b 100644 --- a/parse.py +++ b/parse.py @@ -3,6 +3,16 @@ from pathlib import Path from typing import Dict, Tuple, Union # I have just python3.8 here :( +# ids of the questions which represent a size of a merch product +SIZE_IDS = (312, 313, 314, 316, 319, 320, 321, 322, 323) +# ID of wishlist for ewiges Frühstück +BREAKFASTWISHES_ID = 309 +# Wie heißt die Athenanas? +ATHENE_ID = 305 # ID of the question of how the logo image is to be named +HUMAN_ID = 147 # ticket for a human +MASCOT_ID = 148 # ticket for a mascot + + def parse(filename: Union[str, Path]) -> Tuple[ Dict[int, str], Dict[int, int], @@ -54,29 +64,29 @@ def wiki_stats(items: Dict[int, str], count_items: Dict[int, int], questions: Di '|-\n') for item_id, item_name in items.items(): ret += f"|| {item_name} || {count_items.get(item_id)}\n|-\n" - ret += "|}\n" + ret += "|}\n\n" - # ids of the questions which represent a size of a merch product - size_ids = (312, 313, 314, 316, 319, 320, 321, 322, 323) ret += ('== Merch-Größenverteilung ==\n' '{|class="wikitable sortable"\n' '! Größe/Eigenschaft !! Wert !! Anzahl\n' '|-\n') - for size_id in size_ids: + for size_id in SIZE_IDS: for size, count in quest_answers[size_id].items(): ret += f"|| {questions[size_id]}: || {size[1]} || {count}\n|-\n" - ret += "|}\n" - - athene_id = 305 # ID of the question how the logo image is to be named - human_id = 147 # ticket for a human - mascot_id = 148 # ticket for a mascot + ret += "|}\n\n" + + ret += '== Wünsche an das ewige Frühstück ==\n' + for wish in quest_answers[BREAKFASTWISHES_ID]: + ret += f"*
{wish[1]}\n" + ret += "\n" + def prefix(id_): - return "Mensch sagt:" if id_ == human_id else "Maskottchen sagt:" if id_ == mascot_id else "" + return "Mensch sagt:" if id_ == HUMAN_ID else "Maskottchen sagt:" if id_ == MASCOT_ID else "" ret += ('== Wie heißt das Ding? ==\n' '{|class="wikitable sortable"\n' '! Variante !! Stimmen\n' '|-\n') - for variant, count in quest_answers[athene_id].items(): + for variant, count in quest_answers[ATHENE_ID].items(): ret += f"|| {prefix(variant[0])} {variant[1]} || {count}\n|-\n" ret += "|}\n"