def upsetsByRegion(self): result = [0] * BotConst.NUM_REGIONS query = ("select season, region from game, seasonteam where team1 = seasonTeamId and upsetHappened = 1 and round = %i and year(date) <= %i" % (self.round, self.year)) self.cursor.execute(query) for i in self.cursor: temp = BotConst.getRegions(i['season']) result[temp.index(i['region'].lower())] += 1 return result
def populateRound(): gameInfo = conn.getSeedRegionAllGames() for i in gameInfo: if (i['region1'] != None and i['region2']): i['region1'] = i['region1'].lower() i['region2'] = i['region2'].lower() if (i['region1'] != i['region2']): REGIONS = BotConst.getRegions(i['year']) if ((i['region1'] == REGIONS[0] and i['region2'] == REGIONS[1]) or (i['region1'] == REGIONS[1] and i['region2'] == REGIONS[0])) or ((i['region1'] == REGIONS[2] and i['region2'] == REGIONS[3]) or (i['region1'] == REGIONS[3] and i['region2'] == REGIONS[2])): conn.updateGameRound(i['gameID'], 6) else: conn.updateGameRound(i['gameID'], 7) else: addSeeds = i['seed1'] + i['seed2'] for case in switch(addSeeds): if case(3): conn.updateGameRound(i['gameID'], 5) break if case(4): conn.updateGameRound(i['gameID'], 5) break if case(5): conn.updateGameRound(i['gameID'], 4) break if case(6): if (i['seed1'] == 1 or i['seed2'] == 1): conn.updateGameRound(i['gameID'], 4) else: conn.updateGameRound(i['gameID'], 5) break if case(7): conn.updateGameRound(i['gameID'], 5) break if case(8): if ((i['seed1'] == 6 and i['seed2'] == 2) or (i['seed1'] == 2 and i['seed2'] == 6)): conn.updateGameRound(i['gameID'], 4) else: conn.updateGameRound(i['gameID'], 5) break if case(9): conn.updateGameRound(i['gameID'], 3) break if case(10): if (i['seed1'] == 1 or i['seed2'] == 1): conn.updateGameRound(i['gameID'], 3) elif (i['seed1'] == 3 or i['seed2'] == 3): conn.updateGameRound(i['gameID'], 4) else: conn.updateGameRound(i['gameID'], 5) break if case(11): conn.updateGameRound(i['gameID'], 5) break if case(12): if (i['seed1'] == 10 or i['seed2'] == 10): conn.updateGameRound(i['gameID'], 3) elif ((i['seed1'] == 8 and i['seed2'] == 4) or (i['seed1'] == 4 and i['seed2'] == 8)): conn.updateGameRound(i['gameID'], 4) else: conn.updateGameRound(i['gameID'], 5) break if case(13): conn.updateGameRound(i['gameID'], 4) break if case(14): if (i['seed1'] == 3 or i['seed2'] == 3): conn.updateGameRound(i['gameID'], 3) elif ((i['seed1'] == 1 or i['seed2'] == 1) or (i['seed1'] == 5 or i['seed2'] == 5)): conn.updateGameRound(i['gameID'], 4) else: conn.updateGameRound(i['gameID'], 5) break if case(15): conn.updateGameRound(i['gameID'], 5) break if case(16): if (i['seed1'] == 4 or i['seed2'] == 4): conn.updateGameRound(i['gameID'], 3) elif ((i['seed1'] == 2 or i['seed2'] == 2) or (i['seed1'] == 6 or i['seed2'] == 6)): conn.updateGameRound(i['gameID'], 4) else: conn.updateGameRound(i['gameID'], 5) break if case(17): conn.updateGameRound(i['gameID'], 2) break if case(18): if (i['seed1'] == 5 or i['seed2'] == 5): conn.updateGameRound(i['gameID'], 3) elif ((i['seed1'] == 3 or i['seed2'] == 3) or (i['seed1'] == 7 or i['seed2'] == 7)): conn.updateGameRound(i['gameID'], 4) else: conn.updateGameRound(i['gameID'], 5) break if case(19): conn.updateGameRound(i['gameID'], 5) break if case(20): if (i['seed1'] == 6 or i['seed2'] == 6): conn.updateGameRound(i['gameID'], 3) elif ((i['seed1'] == 4 or i['seed2'] == 4) or (i['seed1'] == 8 or i['seed2'] == 8)): conn.updateGameRound(i['gameID'], 4) else: conn.updateGameRound(i['gameID'], 5) break if case(21): conn.updateGameRound(i['gameID'], 4) break if case(22): if (i['seed1'] == 7 or i['seed2'] == 7): conn.updateGameRound(i['gameID'], 3) elif (i['seed1'] == 9 or i['seed2'] == 9): conn.updateGameRound(i['gameID'], 4) else: conn.updateGameRound(i['gameID'], 5) break if case(23): conn.updateGameRound(i['gameID'], 5) break if case(24): if (i['seed1'] == 8 or i['seed2'] == 8): conn.updateGameRound(i['gameID'], 3) elif (i['seed1'] == 10 or i['seed2'] == 10): conn.updateGameRound(i['gameID'], 4) else: conn.updateGameRound(i['gameID'], 5) break if case(25): conn.updateGameRound(i['gameID'], 3) break if case(26): if (i['seed1'] == 9 or i['seed2'] == 9): conn.updateGameRound(i['gameID'], 3) elif (i['seed1'] == 11 or i['seed2'] == 11): conn.updateGameRound(i['gameID'], 4) else: conn.updateGameRound(i['gameID'], 5) break if case(27): conn.updateGameRound(i['gameID'], 5) break if case(28): if (i['seed1'] == 12 or i['seed2'] == 12): conn.updateGameRound(i['gameID'], 4) else: conn.updateGameRound(i['gameID'], 5) break if case(29): conn.updateGameRound(i['gameID'], 4) break if case(30): conn.updateGameRound(i['gameID'], 5) break if case(31): conn.updateGameRound(i['gameID'], 5) break