openfootball / help

help & support incl. frequently asked questions (FAQs) and answers - let's keep all support question in one issue tracker, thanks
5 stars 4 forks source link

error in 2016 dataset #15

Open 4lp opened 7 years ago

4lp commented 7 years ago

I added a dataset for the 2016 mls season but when I try to build the database, I get the following error:

*** error: undefined method `to_date' for nil:NilClass Did you mean? to_a

I'm pretty sure that there's something wrong with my formatting but I'm not sure what as the formatting is pretty different between the 2014 and 2015 seasons and I can't find much documentation. Can anyone point me in the right direction?

Once I can get the proper formatting down, I think I have a script and datasource which will allow me (or anyone) to add a lot of fixture data quite easily.

4lp commented 7 years ago

Okay, I did some research, found this thread which features some of the contributers, and now know that the "week" designation is necessary. I also found out how to test local data with sportdb, so I can try and figure this out without committing to the repo. Now I have my data in the following format:

Week 1

Mar 06 New York Red Bulls 0-2 Toronto FC
Mar 06 Orlando City 2-2 Real Salt Lake
Mar 06 Chicago Fire 3-4 New York City
Mar 06 San Jose Earthquakes 1-0 Colorado Rapids
Mar 06 Houston Dynamo 3-3 New England Revolution
Mar 06 FC Dallas 2-0 Philadelphia Union
Mar 06 Portland Timbers 2-1 Columbus Crew
Mar 06 Vancouver Whitecaps 2-3 Montreal Impact
Mar 06 Seattle Sounders  0-1 Sporting Kansas City
Mar 06 Los Angeles Galaxy 4-1 DC United

but when I try to sportdb --include my local data I now get the following error:

*** error: SQLite3::ConstraintException: NOT NULL constraint failed: games.play_at: INSERT INTO "games" ("score1", "score2", "round_id", "team1_id", "team2_id", "pos", "winner90", "winner", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

4lp commented 7 years ago

I think I've got it now. The following data could be included into an existing sportdb database:

Week 1

Mar/06 New York Red Bulls 0-2 Toronto FC
Mar/06 Orlando City 2-2 Real Salt Lake
Mar/06 Chicago Fire 3-4 New York City
Mar/06 San Jose Earthquakes 1-0 Colorado Rapids
Mar/06 Houston Dynamo 3-3 New England Revolution
Mar/06 FC Dallas 2-0 Philadelphia Union
Mar/06 Portland Timbers 2-1 Columbus Crew
Mar/06 Vancouver Whitecaps 2-3 Montreal Impact
Mar/06 Seattle Sounders  0-1 Sporting Kansas City
Mar/06 Los Angeles Galaxy 4-1 DC United

I'll update all of 2016 in this format and if it works locally I'll push it to this repo.

4lp commented 7 years ago

Reformatted the 2016 to the above format and everything works great now.

geraldb commented 7 years ago

Thanks for retrying. Sorry I was offline (a week) and, thus, not responding. Thanks for the update. Great that it works now. Keep it up. Cheers.