def report_index(self): ViewMain.report_menu() choice = input() if choice == '0': # back last Menu return self.index() if choice == '1': players = Player.get_all_by_alpha() self.report(players) if choice == '2': players = Player.get_all_by_rank() self.report(players) if choice == '3': tournament_id = TournamentController().select_tournament() if tournament_id is not None: tournament = Tournament.get_tournament(tournament_id) tournament_players = tournament.get_players_by_alpha() players = [ Player.get_player(player) for player in tournament_players ] self.report(players) if choice == '4': tournament_id = TournamentController().select_tournament() if tournament_id is not None: tournament = Tournament.get_tournament(tournament_id) tournament_players = tournament.get_players_by_rank() players = [ Player.get_player(player) for player in tournament_players ] self.report(players) if choice == '5': tournaments = Tournament.TOURNAMENT if len(tournaments) > 0: self.report(tournaments) if choice == '6': tournament_id = TournamentController().select_tournament() if tournament_id is not None: tournament = Tournament.get_tournament(tournament_id) rounds = tournament.rounds self.report(rounds) if choice == '7': tournament_id = TournamentController().select_tournament() if tournament_id is not None: tournament = Tournament.get_tournament(tournament_id) matches = [] for rnd in tournament.rounds: for match in rnd.matches: matches.append(match) # matches.append(match.result_to_string()) self.report(matches) input('Press ENTER to continue') return self.report_index()
def index(self): c = main.MainController() ViewTournament.launch() choice = input() if choice == '0': # back last Menu return c.index() if choice == '1': # Create Tournament tournament = self.new() return self.manage(tournament) elif choice == '2': # Retrieve Tournament tournament_id = self.select_tournament() if tournament_id is not None: tournament = Tournament.get_tournament(tournament_id) return self.manage(tournament) return self.index()