Added file changes made live during competition to make things run smoothly
This commit is contained in:
parent
82fabe69a7
commit
8298cd85a8
@ -61,6 +61,9 @@ class HtmlParticipant:
|
||||
def __hash__(self):
|
||||
return hash((self.id, self.name))
|
||||
|
||||
def __gt__(self, other):
|
||||
return self.id >= other.id
|
||||
|
||||
# class PreviewParticipationData:
|
||||
# def __init__(self, dance: str, class_: competition_class.CompetitionClass):
|
||||
# self.class_ = class_
|
||||
@ -145,6 +148,15 @@ class HtmlSingleCompetitionResult:
|
||||
else:
|
||||
return f'Res({self.name}, placed {place})'
|
||||
|
||||
def __gt__(self,other):
|
||||
return self.id > other.id
|
||||
|
||||
def __eq__(self, other):
|
||||
return self.id == other.id
|
||||
|
||||
def __hash__(self):
|
||||
return hash(self.id)
|
||||
|
||||
class HtmlCompetitionTotalResults:
|
||||
def __init__(self):
|
||||
self.results = {}
|
||||
|
@ -456,7 +456,7 @@ class Worker:
|
||||
dances = self._extractDancesPerGroup(importedData, group)
|
||||
self.l.log(5, 'Found dances in group %s: %s', group, dances)
|
||||
|
||||
participants = self._extractParticipantsPerGroup(importedData.previewImport, group)
|
||||
participants = self._extractParticipantsPerGroup(importedData, group)
|
||||
self.l.log(5, 'Related participants %s', participants)
|
||||
|
||||
results = {}
|
||||
@ -485,24 +485,35 @@ class Worker:
|
||||
|
||||
|
||||
def _extractGroups(self, data: types.State3):
|
||||
groupParser = solo_turnier.group.GroupParser()
|
||||
|
||||
groupSet = set([])
|
||||
for id in data.previewImport.participants:
|
||||
participants = data.previewImport.participants[id]
|
||||
for participant in participants:
|
||||
groupSet.add(participant.group)
|
||||
# for id in data.previewImport.participants:
|
||||
# participants = data.previewImport.participants[id]
|
||||
# for participant in participants:
|
||||
# groupSet.add(participant.group)
|
||||
for tup in data.htmlResults.results.keys():
|
||||
gr = groupParser.parseClass(tup[0])
|
||||
groupSet.add(gr)
|
||||
# self.l.log(5, 'Group type %s', type(gr))
|
||||
|
||||
self.l.log(5, 'Set of active groups: %s', groupSet)
|
||||
groupParser = solo_turnier.group.GroupParser()
|
||||
groups = groupParser.getGroupsAsSortedList(groupSet)
|
||||
return groups
|
||||
|
||||
def _extractDancesPerGroup(self, data: types.State3, group: solo_turnier.group.Group):
|
||||
groupParser = solo_turnier.group.GroupParser()
|
||||
|
||||
dances = set()
|
||||
additionalDances = set()
|
||||
for part in data.previewImport.results.keys():
|
||||
allFoundDances = set(data.previewImport.results[part].keys())
|
||||
dances.update(allFoundDances.intersection(self._allDances))
|
||||
additionalDances.update(allFoundDances.difference(self._allDances))
|
||||
for tup in data.htmlResults.results.keys():
|
||||
if not groupParser.parseClass(tup[0]) == group:
|
||||
continue
|
||||
dances.add(tup[2])
|
||||
# for part in data.previewImport.results.keys():
|
||||
# allFoundDances = set(data.previewImport.results[part].keys())
|
||||
# dances.update(allFoundDances.intersection(self._allDances))
|
||||
# additionalDances.update(allFoundDances.difference(self._allDances))
|
||||
|
||||
if len(additionalDances) > 0:
|
||||
self.l.warning('There were dances found, that are not registered. A bug? The dances were: %s', additionalDances)
|
||||
@ -514,27 +525,45 @@ class Worker:
|
||||
|
||||
def _extractParticipantsPerGroup(
|
||||
self,
|
||||
previewData: types.HtmlPreviewImport,
|
||||
importedData: types.State3,
|
||||
# previewData: types.HtmlPreviewImport,
|
||||
group: solo_turnier.group.Group
|
||||
) -> list[types.HtmlPreviewParticipant]:
|
||||
groupParser = types.group.GroupParser()
|
||||
|
||||
ret = []
|
||||
for id in previewData.participants:
|
||||
participantList = previewData.participants[id]
|
||||
for participant in participantList:
|
||||
if participant.group == group:
|
||||
ret.append(participant)
|
||||
|
||||
self.l.log(5, 'Table %s', pformat(importedData.htmlResults.tabges))
|
||||
self.l.log(5, 'Results %s', pformat(importedData.htmlResults.results))
|
||||
|
||||
for tup in importedData.htmlResults.results.keys():
|
||||
gr = groupParser.parseClass(tup[0])
|
||||
if not gr == group:
|
||||
continue
|
||||
part = importedData.htmlResults.results[tup][0]
|
||||
part.id = int(tup[3])
|
||||
ret.append(part)
|
||||
|
||||
self.l.log(5, 'ret %s', ret)
|
||||
# raise Exception('Test')
|
||||
|
||||
# for id in previewData.participants:
|
||||
# participantList = previewData.participants[id]
|
||||
# for participant in participantList:
|
||||
# if participant.group == group:
|
||||
# ret.append(participant)
|
||||
return ret
|
||||
|
||||
def _getResultOfSingleParticipant(
|
||||
self,
|
||||
participant: types.HtmlPreviewParticipant,
|
||||
participant: types.HtmlParticipant,
|
||||
nominalGroup: solo_turnier.group.Group,
|
||||
previewResults: types.HtmlPreviewImport,
|
||||
totalResults: types.HtmlCompetitionTotalResults,
|
||||
allDances: list[str]
|
||||
) -> list[types.SingleParticipantResult|None]:
|
||||
rawResults = totalResults.getById(participant.id)
|
||||
self.l.log(5, 'Found result data (raw): %s', rawResults)
|
||||
self.l.log(5, 'Found result data for id %i (raw): %s', participant.id, rawResults)
|
||||
|
||||
results = [None for x in allDances]
|
||||
|
||||
@ -589,7 +618,10 @@ class Worker:
|
||||
|
||||
keys = list(importedData.tabges.keys())
|
||||
selected = list(map(selectEntry, keys))
|
||||
selectedIndex = selected.index(True)
|
||||
try:
|
||||
selectedIndex = selected.index(True)
|
||||
except:
|
||||
continue
|
||||
|
||||
raw = importedData.tabges[keys[selectedIndex]]
|
||||
self.l.log(5,'Raw %s', raw)
|
||||
|
Loading…
Reference in New Issue
Block a user