yes/no question stats

This commit is contained in:
Johannes 2023-10-06 18:44:03 +02:00
parent 1b021758f2
commit d5c7c669d6

View file

@ -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"* <pre>{wish[1]}</pre>\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'