def setDataForMatch(match): m = DataModel.Match() f = lambda key: [ match["alliances"]["red"][key], match["alliances"]["blue"][key] ] m.number, m.redAllianceTeamNumbers, m.blueAllianceTeamNumbers = int( match["match_number"]), f("teams")[0], f("teams")[1] m.redScore, m.blueScore, m.TIMDs = 0, 0, [] return m
def setDataForMatch(match): m = DataModel.Match() m.number, m.redAllianceTeamNumbers, m.blueAllianceTeamNumbers = int( match['match_number']), match['alliances']['red']['team_keys'], match[ 'alliances']['blue']['team_keys'] return m
def makeMatchFromDict(d): match = DataModel.Match(**d) if 'calculatedData' in d.keys(): match.calculatedData = DataModel.CalculatedMatchData( **d['calculatedData']) return match
def makeMatchFromDict(d): match = DataModel.Match(**d) #I have no idea why this works if 'calculatedData' in d.keys(): match.calculatedData = DataModel.CalculatedMatchData( **d['calculatedData']) return match