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)
place = str(result.place)
lineOne = f"{placeNative}"
# lineTwo = f"[{place} in {result.competitionClass}]"
lines = [lineOne]
groupCompetition = result.competitionGroup
if isinstance(groupCompetition, solo_turnier.group.CombinedGroup):
lineTwo = f"[{place} in {groupCompetition}]"
lines.append(lineTwo)
if not result.finalist:
lines = ["kein/e Finalist/in"] + lines

View File

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

View File

@ -7,6 +7,7 @@ class SingleParticipantResult:
def __init__(
self,
competitionClass: solo_turnier.competition_class.Class_t,
competitionGroup: solo_turnier.group.Group_t,
nativeClass: solo_turnier.competition_class.CompetitionClass,
dance: str,
finalist: bool,
@ -14,6 +15,7 @@ class SingleParticipantResult:
nativePlace: Place = None,
):
self.competitionClass = competitionClass
self.competitionGroup = competitionGroup
self.nativeClass = nativeClass
self.dance = dance
self.finalist = finalist
@ -27,3 +29,6 @@ class SingleParticipantResult:
def getNativePlace(self) -> str:
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)
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)
self.l.log(5, "Id to participant mappting: %s", idToParticipantMapping)
self.l.log(5, "Id to participant mapping: %s", idToParticipantMapping)
totalResult = {}
@ -96,6 +96,7 @@ class Worker:
singleResult = solo_turnier.types.SingleParticipantResult(
competitionClass=tup.class_,
nativeClass=tup.class_,
competitionGroup=tup.group,
dance=tup.dance,
finalist=singleHtmlResult.finalist,
place=singleHtmlResult.place,