From 7ec359d2f2e57145fc67b64d09952070319d2511 Mon Sep 17 00:00:00 2001 From: Christian Wolf Date: Thu, 14 Mar 2024 13:08:27 +0100 Subject: [PATCH] Add club to output --- src/solo_turnier/output.py | 7 ++++++- src/solo_turnier/templates/index.html | 6 ++++++ src/solo_turnier/types/htmlSingleCompetitionResult.py | 3 ++- src/solo_turnier/types/participant.py | 2 ++ src/solo_turnier/workers/ResultExtractor.py | 2 +- src/solo_turnier/workers/Worker.py | 2 +- 6 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/solo_turnier/output.py b/src/solo_turnier/output.py index 1750a42..9514eb3 100644 --- a/src/solo_turnier/output.py +++ b/src/solo_turnier/output.py @@ -126,7 +126,12 @@ class ConsoleOutputter(AbstractOutputter): return "\n".join(lines) mappedResults = map(mapResultColumn, results) - tableRow = [f"{participant.name} ({participant.id})"] + list(mappedResults) + + participantName = f'{participant.name} ({participant.id})' + if participant.club is not None: + participantName = f'{participantName}, {participant.club}' + + tableRow = [f"{participantName}"] + list(mappedResults) tableData.append(tableRow) self.l.log(5, "table data: %s", pprint.pformat(tableData)) diff --git a/src/solo_turnier/templates/index.html b/src/solo_turnier/templates/index.html index f4f47ef..37f58df 100644 --- a/src/solo_turnier/templates/index.html +++ b/src/solo_turnier/templates/index.html @@ -21,6 +21,7 @@ + {% for dance in data.resultsPerGroup[group].dances %} {% endfor %} @@ -35,6 +36,11 @@ {% if participant.finalist or not onlyFinalists %} + {% for dance in data.resultsPerGroup[group].dances %} {% block danceResult scoped %} {% set res = activeGroup[participant][loop.index0] %} diff --git a/src/solo_turnier/types/htmlSingleCompetitionResult.py b/src/solo_turnier/types/htmlSingleCompetitionResult.py index 175aca0..16e51f8 100644 --- a/src/solo_turnier/types/htmlSingleCompetitionResult.py +++ b/src/solo_turnier/types/htmlSingleCompetitionResult.py @@ -2,10 +2,11 @@ from .place import Place class HtmlSingleCompetitionResult: - def __init__(self, name: str, place: Place, finalist: bool): + def __init__(self, name: str, place: Place, finalist: bool, club: str): self.name = name self.place = place self.finalist = finalist + self.club = club def __repr__(self): place = self.place diff --git a/src/solo_turnier/types/participant.py b/src/solo_turnier/types/participant.py index 8c6efd8..2c965c7 100644 --- a/src/solo_turnier/types/participant.py +++ b/src/solo_turnier/types/participant.py @@ -9,10 +9,12 @@ class Participant(Person): name: str, id: int, finalist: bool = None, + club: str = None, ): super().__init__(name) self.id = id self.finalist = finalist + self.club = club def __repr__(self): if self.finalist == True: diff --git a/src/solo_turnier/workers/ResultExtractor.py b/src/solo_turnier/workers/ResultExtractor.py index 2272a6c..a23181e 100644 --- a/src/solo_turnier/workers/ResultExtractor.py +++ b/src/solo_turnier/workers/ResultExtractor.py @@ -85,7 +85,7 @@ class ResultExtractor: placeStr = result.results[person] place = self._extractPlace(placeStr) competitionResult = types.HtmlSingleCompetitionResult( - person.name, place, person.finalist + person.name, place, person.finalist, person.club ) results.add( competitionGroup, diff --git a/src/solo_turnier/workers/Worker.py b/src/solo_turnier/workers/Worker.py index 39c12ea..166bce5 100644 --- a/src/solo_turnier/workers/Worker.py +++ b/src/solo_turnier/workers/Worker.py @@ -329,7 +329,7 @@ class Worker: if id not in mapping: mapping[id] = solo_turnier.types.Participant( - name=results[0].name, id=id + name=results[0].name, id=id, club=results[0].club ) else: if mapping[id].name != results[0].name or mapping[id].id != id:
TeilnehmerVerein{{ dance }}
{{ participant.name }} ({{ participant.id }}) + {% if participant.club is not none %} + {{ participant.club}} + {% endif %} +