- teamscores = {}
- for pgstat in pgstats:
- if pgstat.team in [5,14,13,10]:
- team = pgstat.team_html_color()
- if pgstat.teamscore is not None:
- if not teamscores.has_key(team):
- teamscores[team] = pgstat.teamscore
- else:
- if teamscores[team] != pgstat.teamscore: # this should not happen!
- teamscores[team] = None
- if len(teamscores) == 0:
- teamscores = None
-
- ### RANDOM SCORES FOR TESTING
- teams = ["red","blue","yellow","pink"]
- random.shuffle(teams)
- teamscores = {}
- for k in range(random.randint(2,4)):
- team = teams[k-1]
- teamscores[team] = random.randint(-5,150)
- ### END
-
- #TeamInfo = namedtuple('TeamInfo', ['team','scoreboardpos','playercount','teamscore'])
- #
- #teams = {}
- #last_pgs = pgstats[0]
- #for pgstat in pgstats:
- # if pgstat.team != last_pgs.team:
- # teams[last_pgs.scoreboardpos] = TeamInfo(
- # team=last_pgs.team,
- # scoreboardpos=last_pgs.scoreboardpos,
- # playercount=pgstat.scoreboardpos-last_pgs.scoreboardpos,
- # teamscore=last_pgs.teamscore)
- # last_pgs = pgstat
- #teams[last_pgs.scoreboardpos] = TeamInfo(
- # team=last_pgs.team,
- # scoreboardpos=last_pgs.scoreboardpos,
- # playercount=pgstat.scoreboardpos-last_pgs.scoreboardpos,
- # teamscore=last_pgs.teamscore)
- #print teams
-