Fix native class from final result table
This commit is contained in:
parent
ee63871e1c
commit
c7212316ee
@ -44,6 +44,11 @@ class CompetitionClassParser:
|
|||||||
self.namesPreview = [
|
self.namesPreview = [
|
||||||
'Sichtung'
|
'Sichtung'
|
||||||
]
|
]
|
||||||
|
self.mapShortNames = {
|
||||||
|
'N': self.NEWC,
|
||||||
|
'B': self.BEG,
|
||||||
|
'A': self.ADV,
|
||||||
|
}
|
||||||
|
|
||||||
def parseClass(self, cls: str, allowPreview: bool = False) -> Class_t:
|
def parseClass(self, cls: str, allowPreview: bool = False) -> Class_t:
|
||||||
if allowPreview and cls in self.namesPreview:
|
if allowPreview and cls in self.namesPreview:
|
||||||
@ -57,6 +62,9 @@ class CompetitionClassParser:
|
|||||||
else:
|
else:
|
||||||
return self.mapNames[cls]
|
return self.mapNames[cls]
|
||||||
|
|
||||||
|
def parseAbbreviatedClass(self, cls: str) -> Class_t:
|
||||||
|
return self.mapShortNames[cls]
|
||||||
|
|
||||||
def isPureClass(self, cls: str, allowPreview: bool = False) -> bool:
|
def isPureClass(self, cls: str, allowPreview: bool = False) -> bool:
|
||||||
parsedClass = self.parseClass(cls, allowPreview)
|
parsedClass = self.parseClass(cls, allowPreview)
|
||||||
return isinstance(parsedClass, CompetitionClass)
|
return isinstance(parsedClass, CompetitionClass)
|
||||||
|
@ -550,7 +550,9 @@ class Worker:
|
|||||||
raise Exception('Multiple results found with same key')
|
raise Exception('Multiple results found with same key')
|
||||||
rawResult = rawResult[0]
|
rawResult = rawResult[0]
|
||||||
|
|
||||||
nativeClass = previewResults.results[participant][dance]
|
nativeClass = key[2]
|
||||||
|
# nativeClass = previewResults.results[participant][dance]
|
||||||
|
# nativeClass = key[2]
|
||||||
|
|
||||||
# self.l.log(5, 'Result %s => %s', key, rawResult)
|
# self.l.log(5, 'Result %s => %s', key, rawResult)
|
||||||
ret = types.SingleParticipantResult(
|
ret = types.SingleParticipantResult(
|
||||||
@ -565,13 +567,15 @@ class Worker:
|
|||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
def _fixNativePlacesFromTable(
|
def _fixNativeDataFromTable(
|
||||||
self,
|
self,
|
||||||
dances: list[str],
|
dances: list[str],
|
||||||
data: dict[types.HtmlPreviewParticipant, list[types.SingleParticipantResult]],
|
data: dict[types.HtmlPreviewParticipant, list[types.SingleParticipantResult]],
|
||||||
importedData: types.HtmlCompetitionTotalResults
|
importedData: types.HtmlCompetitionTotalResults
|
||||||
):
|
):
|
||||||
rePlace = re.compile('([0-9]+)(?:-([0-9]+))?')
|
rePlace = re.compile('([0-9]+)(?:-([0-9]+))?')
|
||||||
|
classParser = competition_class.CompetitionClassParser()
|
||||||
|
|
||||||
for participant in data.keys():
|
for participant in data.keys():
|
||||||
self.l.log(5, 'fixing participant %s', participant)
|
self.l.log(5, 'fixing participant %s', participant)
|
||||||
results = data[participant]
|
results = data[participant]
|
||||||
@ -598,6 +602,9 @@ class Worker:
|
|||||||
result.placeNative = matcher.group(1)
|
result.placeNative = matcher.group(1)
|
||||||
result.placeNativeTo = matcher.group(2)
|
result.placeNativeTo = matcher.group(2)
|
||||||
|
|
||||||
|
if raw[1] is not None:
|
||||||
|
result.nativeClass = classParser.parseAbbreviatedClass(raw[1])
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _fixNativePlaces(
|
def _fixNativePlaces(
|
||||||
|
Loading…
Reference in New Issue
Block a user