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

Issue with random game IDs #17

Closed
zenverak opened this issue Nov 2, 2016 · 2 comments
Closed

Issue with random game IDs #17

zenverak opened this issue Nov 2, 2016 · 2 comments
Labels

Comments

@zenverak
Copy link

zenverak commented Nov 2, 2016

I am currently looping through games in a season to gather data. I then use that game id to generate some more data.

Note the following game IDs

id is 2016_04_03_slnmlb_pitmlb_1
id is 2016_04_03_nynmlb_kcamlb_1
id is 2016_04_03_tormlb_tbamlb_1
id is 2016_04_03_chnmlb_anamlb_1
id is 2016_04_04_phimlb_cinmlb_1
id is 2016_04_04_lanmlb_sdnmlb_1
id is 2016_04_04_colmlb_arimlb_1
id is 2016_04_04_chnmlb_anamlb_1
id is 2016_04_04_sfnmlb_milmlb_1
id is 2016_04_04_tormlb_tbamlb_1
id is 2016_04_04_houmlb_nyamlb_1

When I run

stats = mlbgame.team_stats(game_id)

everything is fine up until the last id

2016_04_04_houmlb_nyamlb_1

I get the following error

Could not find a game with that id.

Any idea how that can happen? The id is generated from the game object itself. Seems a bit odd to me.

Edit: After doing more research I believe what is happening here is that these are game IDs for game that actually didn't happen/post poned. They get a game id but when I try to search for them in in team_stats() it fails.

I am not sure if this was intended or not.

Edit 2:

I ran my program with a try to find which game_ids for the whole season were not able to be found by

mlbgame.team_stats()

They were

CAN'T FIND a game with id of 2016_04_04_bosmlb_clemlb_1
CAN'T FIND a game with id of 2016_04_09_miamlb_wasmlb_1
CAN'T FIND a game with id of 2016_04_10_nyamlb_detmlb_1
CAN'T FIND a game with id of 2016_04_17_balmlb_texmlb_1
CAN'T FIND a game with id of 2016_04_27_milmlb_chnmlb_1
CAN'T FIND a game with id of 2016_04_28_pitmlb_colmlb_1
CAN'T FIND a game with id of 2016_04_30_atlmlb_chnmlb_1
CAN'T FIND a game with id of 2016_05_16_bosmlb_kcamlb_1
CAN'T FIND a game with id of 2016_05_26_chamlb_kcamlb_1
CAN'T FIND a game with id of 2016_09_25_atlmlb_miamlb_1

I assume there would be more than ten rainouts/ cancelled games

@panzarino
Copy link
Owner

Chances are that those games were cancelled. Can you check if the game type is sg_game? This game type means that the game wasn't played, which could lead to these errors.

I will investigate further.

@panzarino panzarino added the bug label Nov 3, 2016
@panzarino
Copy link
Owner

So the games that you are getting an error with are games that were not played. Unfortunately, to check this on the API side would be too inefficient for a majority of users and should be done by the client.

In this case, you should check the type of the game and if it is sg_game, do not try to get stats for that game because they don't exist.

@panzarino panzarino added wontfix and removed bug labels Nov 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants