[go: nahoru, domu]

Skip to content

Commit

Permalink
removed usages of deprecated api function (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
coolbrett committed Feb 8, 2023
1 parent 477089a commit b1d920c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
22 changes: 5 additions & 17 deletions LeagueData.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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']
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down

0 comments on commit b1d920c

Please sign in to comment.