Add finalist attribute to objects

This commit is contained in:
Christian Wolf 2022-11-15 14:38:46 +01:00
parent 26d37a7237
commit 4275466cca
2 changed files with 9 additions and 2 deletions

View File

@ -44,7 +44,8 @@ def test_extractCompetitionFromRow():
'group': 'Kin', 'group': 'Kin',
'place': '2', 'place': '2',
'placeTo': '2', 'placeTo': '2',
'id': 2 'id': 2,
'finalist': None
} }
assert person.__dict__ == expected assert person.__dict__ == expected

View File

@ -59,6 +59,7 @@ class CompetitionResult:
self.place = place self.place = place
self.placeTo = placeTo self.placeTo = placeTo
self.id = int(id) self.id = int(id)
self.finalist = None
@staticmethod @staticmethod
def extractFromResultRow(row: ResultRow): def extractFromResultRow(row: ResultRow):
@ -75,7 +76,12 @@ class CompetitionResult:
result = f'{self.place}.' result = f'{self.place}.'
else: else:
result = f'{self.place}.-{self.placeTo}.' result = f'{self.place}.-{self.placeTo}.'
return f'Result[{self.id}]({self.group} {self.class_} {self.dance} as {result})'
if self.finalist == True:
finalist = '[F]'
else:
finalist = ''
return f'Result[{self.id}]({self.group} {self.class_} {self.dance} as {result}{finalist})'
def __eq__(self, o): def __eq__(self, o):
if not isinstance(o, CompetitionResult): if not isinstance(o, CompetitionResult):