Skip to content

Commit

Permalink
Fix team_scores json
Browse files Browse the repository at this point in the history
  • Loading branch information
Saturn committed Jan 14, 2019
1 parent dfc3ba3 commit 3907d0b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion soccer/request_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def get_team_scores(self, team, time, show_upcoming, use_12_hour_format):
click.secho("No action during past week. Change the time "
"parameter to get more fixtures.", fg="red", bold=True)
else:
self.writer.team_scores(team_scores, time, show_upcoming, use_12_hour_format)
self.writer.team_scores(team_scores, time)
except APIErrorException as e:
click.secho(e.args[0],
fg="red", bold=True)
Expand Down
12 changes: 6 additions & 6 deletions soccer/writers.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,13 +302,13 @@ def live_scores(self, live_scores):
def team_scores(self, team_scores, time):
"""Store output of team scores to a JSON file"""
data = []
for score in team_scores['fixtures']:
for score in team_scores['matches']:
if score['status'] == 'FINISHED':
item = {'date': score["date"].split('T')[0],
'homeTeamName': score['homeTeamName'],
'goalsHomeTeam': score['result']['goalsHomeTeam'],
'goalsAwayTeam': score['result']['goalsAwayTeam'],
'awayTeamName': score['awayTeamName']}
item = {'date': score["utcDate"].split('T')[0],
'homeTeamName': score['homeTeam']['name'],
'goalsHomeTeam': score['score']['fullTime']['homeTeam'],
'goalsAwayTeam': score['score']['fullTime']['awayTeam'],
'awayTeamName': score['awayTeam']['name']}
data.append(item)
self.generate_output({'team_scores': data})

Expand Down

0 comments on commit 3907d0b

Please sign in to comment.