From b1d920c663a9fe4fef7a426d40c7dc7866e997a6 Mon Sep 17 00:00:00 2001 From: Brett Dale Date: Tue, 7 Feb 2023 22:34:21 -0500 Subject: [PATCH] removed usages of deprecated api function (#12) --- LeagueData.py | 22 +++++----------------- README.md | 2 -- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/LeagueData.py b/LeagueData.py index 4b86383..1134cf5 100644 --- a/LeagueData.py +++ b/LeagueData.py @@ -61,9 +61,9 @@ def three_weeks_total_as_string(self, week: int) -> str: def __get_last_three_weeks_data(self, week: int): """Helper method to get the three weeks data""" - three_weeks_data = {'current_week': self.league.scoreboard(week), - 'previous_week': self.league.scoreboard(week - 1), - 'two_weeks_back': self.league.scoreboard(week - 2)} + three_weeks_data = {'current_week': self.league.box_scores(week), + 'previous_week': self.league.box_scores(week - 1), + 'two_weeks_back': self.league.box_scores(week - 2)} return three_weeks_data def __build_list_three_weeks_data(self, three_weeks_data: dict): @@ -81,9 +81,9 @@ def __build_list_three_weeks_data(self, three_weeks_data: dict): for j in range(len(three_weeks_list)): if home_team.team_abbrev == three_weeks_list[j]['team_abbrev']: - three_weeks_list[j]['past_three_weeks_total'] += matchup.home_final_score + three_weeks_list[j]['past_three_weeks_total'] += matchup.home_score if away_team.team_abbrev == three_weeks_list[j]['team_abbrev']: - three_weeks_list[j]['past_three_weeks_total'] += matchup.away_final_score + three_weeks_list[j]['past_three_weeks_total'] += matchup.away_score def sort_three_weeks_list(list: list): return list['past_three_weeks_total'] @@ -171,18 +171,6 @@ def get_box_score_of_matchup(self, week: int, team: Team) -> box_score: if box_score.away_team.team_id == team.team_id or box_score.home_team.team_id == team.team_id: return box_score - def get_box_scores_and_matchups_of_week(self, week: int) -> list: - """Grabs list of box scores and matchups of week given, and returns a list of dictionaries - containing the matchups and their corresponding box scores""" - box_scores = self.league.box_scores(matchup_period=week) - matchups = self.league.scoreboard(matchupPeriod=week) - data = [] - count = 0 - for matchup in matchups: - data.append({matchup: box_scores[count]}) - count += 1 - return data - def shorten_player_name(self, player_name: str) -> str: """Shortens player name to be first inital then last name [G. Antetokounmpo]""" temp = player_name.split() diff --git a/README.md b/README.md index 60d5fbc..ec2ed9c 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,6 @@ PROCESS TO-DO ----- -- Try and make the commands uniform -- scoreboard kind of sucks, record-vs-all-teams looks the best -- replace usages of scoreboard() - get_record_vs_all_teams doesn't work if team has a bye - make /issue command to report issues - Add logging?