Add optional output for combined groups

This commit is contained in:
Christian Wolf 2024-03-14 18:52:23 +01:00
parent 7ec359d2f2
commit a7f8bad0ec
4 changed files with 19 additions and 4 deletions

View File

@ -117,9 +117,14 @@ class ConsoleOutputter(AbstractOutputter):
placeNative = str(result.nativePlace) placeNative = str(result.nativePlace)
place = str(result.place) place = str(result.place)
lineOne = f"{placeNative}" lineOne = f"{placeNative}"
# lineTwo = f"[{place} in {result.competitionClass}]"
lines = [lineOne] lines = [lineOne]
groupCompetition = result.competitionGroup
if isinstance(groupCompetition, solo_turnier.group.CombinedGroup):
lineTwo = f"[{place} in {groupCompetition}]"
lines.append(lineTwo)
if not result.finalist: if not result.finalist:
lines = ["kein/e Finalist/in"] + lines lines = ["kein/e Finalist/in"] + lines

View File

@ -51,6 +51,10 @@
{% endif %} {% endif %}
<span class="{% if not res.finalist %}no-finalist-dance{% endif %}"> <span class="{% if not res.finalist %}no-finalist-dance{% endif %}">
{{ res.getNativePlace() }} {{ res.getNativePlace() }}
{% if res.isCombinedGroup() %}
<br />
({{ res.place }} {{ res.competitionGroup }})
{% endif %}
</span> </span>
{% endif %} {% endif %}
</td> </td>

View File

@ -7,6 +7,7 @@ class SingleParticipantResult:
def __init__( def __init__(
self, self,
competitionClass: solo_turnier.competition_class.Class_t, competitionClass: solo_turnier.competition_class.Class_t,
competitionGroup: solo_turnier.group.Group_t,
nativeClass: solo_turnier.competition_class.CompetitionClass, nativeClass: solo_turnier.competition_class.CompetitionClass,
dance: str, dance: str,
finalist: bool, finalist: bool,
@ -14,6 +15,7 @@ class SingleParticipantResult:
nativePlace: Place = None, nativePlace: Place = None,
): ):
self.competitionClass = competitionClass self.competitionClass = competitionClass
self.competitionGroup = competitionGroup
self.nativeClass = nativeClass self.nativeClass = nativeClass
self.dance = dance self.dance = dance
self.finalist = finalist self.finalist = finalist
@ -27,3 +29,6 @@ class SingleParticipantResult:
def getNativePlace(self) -> str: def getNativePlace(self) -> str:
return str(self.nativePlace) return str(self.nativePlace)
def isCombinedGroup(self) -> bool:
return isinstance(self.competitionGroup, solo_turnier.group.CombinedGroup)

View File

@ -42,10 +42,10 @@ class Worker:
self.l.debug("Found groups in the dataset: %s", groups) self.l.debug("Found groups in the dataset: %s", groups)
invertedGroupMapping = self._invertGroupMapping(groupMapping, groups) invertedGroupMapping = self._invertGroupMapping(groupMapping, groups)
self.l.log(5, "Inverted group maping: %s", invertedGroupMapping) self.l.log(5, "Inverted group mapping: %s", invertedGroupMapping)
idToParticipantMapping = self._invertIdMapping(importedData.htmlResults) idToParticipantMapping = self._invertIdMapping(importedData.htmlResults)
self.l.log(5, "Id to participant mappting: %s", idToParticipantMapping) self.l.log(5, "Id to participant mapping: %s", idToParticipantMapping)
totalResult = {} totalResult = {}
@ -96,6 +96,7 @@ class Worker:
singleResult = solo_turnier.types.SingleParticipantResult( singleResult = solo_turnier.types.SingleParticipantResult(
competitionClass=tup.class_, competitionClass=tup.class_,
nativeClass=tup.class_, nativeClass=tup.class_,
competitionGroup=tup.group,
dance=tup.dance, dance=tup.dance,
finalist=singleHtmlResult.finalist, finalist=singleHtmlResult.finalist,
place=singleHtmlResult.place, place=singleHtmlResult.place,