albertlyu / shot-charts-site

A Rails web application for visualizing NCAA men's basketball play-by-play shot location data
MIT License
3 stars 1 forks source link

Generate new models for teamgames and playergames, re-seed players table #7

Closed albertlyu closed 10 years ago

albertlyu commented 10 years ago

With the new boxscore json files thanks to albertlyu/ncaab-pbp#4, we'll need to generate new ActiveRecord models for teamgames and playergames as well as recreate and reseed the players table in the database. Modify seeds.rb with care, as we don't want to re-seed the very large plays table.

We can generate the models like so:

rails generate model Playergame game_id:primary_key player_id:primary_key team_id:integer player_first_name:string player_last_name:string player_position:integer player_uniform_number:integer field_goals_made:integer field_goals_att:integer field_goals_pct:float free_throws_made:integer free_throws_att:integer free_throws_pct:float three_point_field_goals_made:integer three_point_field_goals_att:integer three_point_field_goals_pct:float points:integer rebounds_total:integer rebounds_off:integer rebounds_def:integer assists:integer steals:integer blocked_shots:integer turnovers:integer personal_fouls:integer disqualifications:integer technical_fouls:integer minutes:integer ejections:integer starter:boolean
rails generate model Teamgame game_id:primary_key team_id:primary_key field_goals_made:integer field_goals_att:integer field_goals_pct:float free_throws_made:integer free_throws_att:integer free_throws_pct:float three_point_field_goals_made:integer three_point_field_goals_att:integer three_point_field_goals_pct:float points:integer rebounds_total:integer rebounds_off:integer rebounds_def:integer assists:integer steals:integer blocked_shots:integer turnovers:integer personal_fouls:integer technical_fouls:integer ejections:integer minutes:integer 

But the Playergame model is a priority over the Teamgame model.

For the Player model, add player_position and player_uniform_number.