def team_list(self): """ A method for populating the Teams page in the UI. Returns a list of all teams in the League class along with their IDs. """ data_out = [] for div, teams in self.Divisions.items(): for team in teams: if hasattr(self.Teams[team], 'Name') and hasattr(self.Teams[team], 'City'): AUDL_Name = self.Teams[team].City + " " + self.Teams[team].Name new_tup = (AUDL_Name, self.Teams[team].ID, sr.id_to_abbrev(self.Teams[team].ID), div) data_out.sort(key= lambda set: set[0]) data_out.append(new_tup) return data_out
def standings(self): standings_list=[] for div,teams in self.Divisions.items(): div_list=[] #print teams for team in teams: t = self.Teams[team] rec = t.record() team_rec_tup = (t.full_name(),team,rec[0], rec[1], rec[2], sr.id_to_abbrev(team)) div_list.append(team_rec_tup) div_list.sort(key= lambda set: 0 if 0 == set[2]+set[3] else (float(set[2])/(float(set[2]+set[3])),float(set[2]),-float(set[3]),set[4]), reverse=True) div_list.insert(0,div) standings_list.append(div_list) return standings_list
def team_list(self): """ A method for populating the Teams page in the UI. Returns a list of all teams in the League class along with their IDs. """ data_out = [] for div, teams in self.Divisions.items(): for team in teams: if hasattr(self.Teams[team], 'Name') and hasattr( self.Teams[team], 'City'): AUDL_Name = self.Teams[team].City + " " + self.Teams[ team].Name new_tup = (AUDL_Name, self.Teams[team].ID, sr.id_to_abbrev(self.Teams[team].ID), div) data_out.sort(key=lambda set: set[0]) data_out.append(new_tup) return data_out
def standings(self): standings_list = [] for div, teams in self.Divisions.items(): div_list = [] #print teams for team in teams: t = self.Teams[team] rec = t.record() team_rec_tup = (t.full_name(), team, rec[0], rec[1], rec[2], sr.id_to_abbrev(team)) div_list.append(team_rec_tup) div_list.sort(key=lambda set: 0 if 0 == set[2] + set[3] else (float(set[2]) / (float(set[2] + set[3])), float(set[2]), -float(set[3]), set[4]), reverse=True) div_list.insert(0, div) standings_list.append(div_list) return standings_list