Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Home|Away Turnovers #281

Closed
wants to merge 1 commit into from
Closed

Fix Home|Away Turnovers #281

wants to merge 1 commit into from

Conversation

joeycortez42
Copy link

Modified version of #197.

Fixed home_turnovers and away_turnovers mapping from timeout mapping.
Added command line option to update game turnovers.

Modified version of #197.

Fixed home_turnovers and away_turnovers mapping from timeout mapping.
Added command line option to update game turnovers.
@flipperbw
Copy link

Not sure what stats_home and stats_away are but they do not exist, and makes this change fail.

@joeycortez42
Copy link
Author

@flipperbw What happens when you run this in a python file?

import nflgame
game = nflgame.one(2017, 1, 'CIN', 'BAL')
print game.home, game.stats_home.turnovers, 'turnovers'
print game.away, game.stats_away.turnovers, 'turnovers'

@flipperbw
Copy link

flipperbw commented Nov 4, 2017

I wound up using #197 (with some fixes of its own, some typos there). So I'm not sure, but can't really go back to check. It said this though:

Traceback (most recent call last):
  File "/usr/local/bin/nfldb-update", line 42, in <module>
    nfldb.update.run(**vars(args))
  File "/usr/local/lib/python2.7/dist-packages/nfldb/update.py", line 574, in run
    doit()
  File "/usr/local/lib/python2.7/dist-packages/nfldb/update.py", line 564, in doit
    update_games(db, batch_size=batch_size)
  File "/usr/local/lib/python2.7/dist-packages/nfldb/update.py", line 414, in update_games
    update_current_week_schedule(db)
  File "/usr/local/lib/python2.7/dist-packages/nfldb/update.py", line 321, in update_current_week_schedule
    g = game_from_id(cursor, gsis_id)
  File "/usr/local/lib/python2.7/dist-packages/nfldb/update.py", line 58, in game_from_id
    return game_from_schedule(cursor, gsis_id)
  File "/usr/local/lib/python2.7/dist-packages/nfldb/update.py", line 105, in game_from_schedule
    return nfldb.Game._from_schedule(cursor.connection, s)
  File "/usr/local/lib/python2.7/dist-packages/nfldb/types.py", line 2164, in _from_schedule
    return Game._from_nflgame(db, _Game())
  File "/usr/local/lib/python2.7/dist-packages/nfldb/types.py", line 2115, in _from_nflgame
    dbg.home_turnovers = int(g.stats_home.turnovers)
AttributeError: '_Game' object has no attribute 'stats_home'

@joeycortez42
Copy link
Author

@flipperbw I got the same thing trying to update after this weeks games. But I ran it again and it worked. I feel like there is a cache issue with nfldb and nflgame. I'm going to modify the pull request to fix this.

Thanks!

@jayhova3g
Copy link

@nokemono42 Were you able to fix the suspected cache issue with nfldb and nflgame? I'm using #287 and I'm still getting the following errors:

nfldb-update
Namespace(batch_size=5, interval=None, player_interval=43200, simulate=None, update_schedules=False, update_turnovers=False)

STARTING NFLDB UPDATE AT 2017-12-18 07:26:58.227374
Connecting to nfldb... done.
Setting timezone to UTC... done.
Locking write access to tables... done.
Updating season phase, year and week... done.
Bulk inserting data for 48 games...
Sending batch of data to database.
Sending batch of data to database.
Sending batch of data to database.
Sending batch of data to database.
Sending batch of data to database.
Sending batch of data to database.
Sending batch of data to database.
Sending batch of data to database.
Sending batch of data to database.
Sending batch of data to database.
done.
Updating schedule JSON database...
Last updated: 2017-12-18 13:24:01.532627
done.
Updating schedule for (Regular, 2017, 15)
Traceback (most recent call last):
File "/usr/local/bin/nfldb-update", line 42, in
nfldb.update.run(**vars(args))
File "/Users/cyclone/Library/Python/2.7/lib/python/site-packages/nfldb/update.py", line 575, in run
doit()
File "/Users/cyclone/Library/Python/2.7/lib/python/site-packages/nfldb/update.py", line 565, in doit
update_games(db, batch_size=batch_size)
File "/Users/cyclone/Library/Python/2.7/lib/python/site-packages/nfldb/update.py", line 414, in update_games
update_current_week_schedule(db)
File "/Users/cyclone/Library/Python/2.7/lib/python/site-packages/nfldb/update.py", line 321, in update_current_week_schedule
g = game_from_id(cursor, gsis_id)
File "/Users/cyclone/Library/Python/2.7/lib/python/site-packages/nfldb/update.py", line 58, in game_from_id
return game_from_schedule(cursor, gsis_id)
File "/Users/cyclone/Library/Python/2.7/lib/python/site-packages/nfldb/update.py", line 105, in game_from_schedule
return nfldb.Game._from_schedule(cursor.connection, s)
File "/Users/cyclone/Library/Python/2.7/lib/python/site-packages/nfldb/types.py", line 2162, in _from_schedule
return Game._from_nflgame(db, _Game())
File "/Users/cyclone/Library/Python/2.7/lib/python/site-packages/nfldb/types.py", line 2114, in _from_nflgame
dbg.home_turnovers = int(g.stats_home.turnovers)
AttributeError: '_Game' object has no attribute 'stats_home'

@joeycortez42
Copy link
Author

@jayhova3g #287 Addresses this issue. I have been running it for a few weeks now with no problem.

@jayhova3g
Copy link

Thank you for responding. I think I had an configuration error on my computer. I deleted and reinstalled #287. I haven't had anymore issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants