Extract groups for pure combined competitions

This commit is contained in:
Christian Wolf 2023-11-19 14:20:12 +01:00
parent 727ce0ca3a
commit 30e4a43a9f
2 changed files with 10 additions and 2 deletions

View File

@ -7,6 +7,9 @@ class Group:
def __repr__(self): def __repr__(self):
return self.name return self.name
def getContainedGroups(self):
return (self,)
class CombinedGroup: class CombinedGroup:
def __init__(self, grpA: Group, grpB: Group): def __init__(self, grpA: Group, grpB: Group):
self.clsA = grpA self.clsA = grpA
@ -15,6 +18,9 @@ class CombinedGroup:
def __repr__(self): def __repr__(self):
return f'{self.clsA}/{self.clsB}' return f'{self.clsA}/{self.clsB}'
def getContainedGroups(self):
return (self.clsA, self.clsB)
Group_t = Group | CombinedGroup Group_t = Group | CombinedGroup
class GroupParser: class GroupParser:

View File

@ -494,7 +494,8 @@ class Worker:
# groupSet.add(participant.group) # groupSet.add(participant.group)
for tup in data.htmlResults.results.keys(): for tup in data.htmlResults.results.keys():
gr = groupParser.parseClass(tup[0]) gr = groupParser.parseClass(tup[0])
groupSet.add(gr) # groupSet.add(gr)
groupSet.update(gr.getContainedGroups())
# self.l.log(5, 'Group type %s', type(gr)) # self.l.log(5, 'Group type %s', type(gr))
self.l.log(5, 'Set of active groups: %s', groupSet) self.l.log(5, 'Set of active groups: %s', groupSet)
@ -508,7 +509,8 @@ class Worker:
additionalDances = set() additionalDances = set()
foundDances = set() foundDances = set()
for tup in data.htmlResults.results.keys(): for tup in data.htmlResults.results.keys():
if not groupParser.parseClass(tup[0]) == group: currentGroup = groupParser.parseClass(tup[0])
if group not in currentGroup.getContainedGroups():
continue continue
foundDances.add(tup[2]) foundDances.add(tup[2])