Add club to output

This commit is contained in:
Christian Wolf 2024-03-14 13:08:27 +01:00
parent 5c4b0106fc
commit 7ec359d2f2
6 changed files with 18 additions and 4 deletions

View File

@ -126,7 +126,12 @@ class ConsoleOutputter(AbstractOutputter):
return "\n".join(lines) return "\n".join(lines)
mappedResults = map(mapResultColumn, results) 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) tableData.append(tableRow)
self.l.log(5, "table data: %s", pprint.pformat(tableData)) self.l.log(5, "table data: %s", pprint.pformat(tableData))

View File

@ -21,6 +21,7 @@
<table class="tab-summary"> <table class="tab-summary">
<tr> <tr>
<th>Teilnehmer</th> <th>Teilnehmer</th>
<th>Verein</th>
{% for dance in data.resultsPerGroup[group].dances %} {% for dance in data.resultsPerGroup[group].dances %}
<th>{{ dance }}</th> <th>{{ dance }}</th>
{% endfor %} {% endfor %}
@ -35,6 +36,11 @@
{% if participant.finalist or not onlyFinalists %} {% if participant.finalist or not onlyFinalists %}
<tr class="{{ rowCls }}"> <tr class="{{ rowCls }}">
<td>{{ participant.name }} ({{ participant.id }})</td> <td>{{ participant.name }} ({{ participant.id }})</td>
<td>
{% if participant.club is not none %}
{{ participant.club}}
{% endif %}
</td>
{% for dance in data.resultsPerGroup[group].dances %} {% for dance in data.resultsPerGroup[group].dances %}
{% block danceResult scoped %} {% block danceResult scoped %}
{% set res = activeGroup[participant][loop.index0] %} {% set res = activeGroup[participant][loop.index0] %}

View File

@ -2,10 +2,11 @@ from .place import Place
class HtmlSingleCompetitionResult: 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.name = name
self.place = place self.place = place
self.finalist = finalist self.finalist = finalist
self.club = club
def __repr__(self): def __repr__(self):
place = self.place place = self.place

View File

@ -9,10 +9,12 @@ class Participant(Person):
name: str, name: str,
id: int, id: int,
finalist: bool = None, finalist: bool = None,
club: str = None,
): ):
super().__init__(name) super().__init__(name)
self.id = id self.id = id
self.finalist = finalist self.finalist = finalist
self.club = club
def __repr__(self): def __repr__(self):
if self.finalist == True: if self.finalist == True:

View File

@ -85,7 +85,7 @@ class ResultExtractor:
placeStr = result.results[person] placeStr = result.results[person]
place = self._extractPlace(placeStr) place = self._extractPlace(placeStr)
competitionResult = types.HtmlSingleCompetitionResult( competitionResult = types.HtmlSingleCompetitionResult(
person.name, place, person.finalist person.name, place, person.finalist, person.club
) )
results.add( results.add(
competitionGroup, competitionGroup,

View File

@ -329,7 +329,7 @@ class Worker:
if id not in mapping: if id not in mapping:
mapping[id] = solo_turnier.types.Participant( mapping[id] = solo_turnier.types.Participant(
name=results[0].name, id=id name=results[0].name, id=id, club=results[0].club
) )
else: else:
if mapping[id].name != results[0].name or mapping[id].id != id: if mapping[id].name != results[0].name or mapping[id].id != id: