Closed Carbja23 closed 5 years ago
It looks like this is happening because of the switch to league.box_scores pulling the current week's scores. Since the week has ended, they've all reset to 0. Unfortunately, box_scores doesn't easily accept a negative number.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'tuple' object has no attribute 'box_scores'```
It looks like the API assumes Tuesday morning as part of the next week.
get_scoreboard_short will need to take a parameter for the week, perhaps defaulting to 0.
# default the week to current week, possible to override
def get_scoreboard_short(league, week=0):
#Gets current week's scoreboard
box_scores = league.box_scores(week)
score = ['%s %.2f - %.2f %s' % (i.home_team.team_abbrev, i.home_score,
i.away_score, i.away_team.team_abbrev) for i in box_scores
if i.away_team]
text = ['Actual Score Update'] + score
return '\n'.join(text)
This would require another function to calculate the previous week number though. I glanced through the espn_ff_api and it doesn't look like there's a way to return the current week number anywhere.
A workaround option could be to set the cron job to run at 11:59:59 Monday, as I'd imagine the rollover into the next week starts on Tuesday.
The League object in ff_espn_api does have a current week variable “current_week”. For Tuesday update you can pass in league.current_week - 1 to box_scores
Experiencing same issue. Has the fix been pushed to master branch?
Yeah I'm experiencing the same issue today too. https://i.imgur.com/gHe39QB.png?1
So is this going to break power rankings tonight? I’ll just disable the bot if that isn’t going to work either
I don't think this should affect power rankings, the existing logic for current week should work with the power rankings
Yeah power rankings still work and everything else works expect the final end of week update on Tuesday
Makes sense, thanks.
Any chance of getting this fix merged so we can deploy before game time tonight?
I could be wrong, but I think the issue is only seen on Tuesday mornings final score and trophy updates. I don't think there should be an issue with tonights matchup/projections updates.
@Jsayer7 is correct. I will try to find time today to review the PR and get the Tuesday fix merged in.
Yes -- Post update from this week the bot is displaying 00 for all scores and trophies.