ynnadkrap / balldontlie

NBA API
http://www.balldontlie.io
225 stars 19 forks source link

Season totals #1

Open cailborg opened 5 years ago

cailborg commented 5 years ago

Hi there, is there an easy way to grab a players season total stats without having to dig in and loop over each game in the season? e.g total points, rebounds, assists, etc

ChrisKatsaras commented 5 years ago

In addition, I'd love to see endpoints for league leaders, etc!

ynnadkrap commented 5 years ago

I have a branch where I'm working on season averages, but this also seems like a good idea. I haven't spent as much time as I'd like on this lately, so I'm not sure what the timetable looks like for this. Feel free to open PRs if you don't feel like waiting on me :)

cailborg commented 5 years ago

That would be great. In the mean time, i've just used a map function to loop over each game and combine the results into totals: https://github.com/cailborg/nba/blob/master/server.js

ynnadkrap commented 5 years ago

Just added the ability to fetch season averages. Is there still a demand for season totals?

cailborg commented 5 years ago

Just added the ability to fetch season averages. Is there still a demand for season totals?

Hi Danny, if possible that would be excellent

ChrisKatsaras commented 5 years ago

@ynnadkrap Thanks for adding this! I would love to see season totals added as well.

andrewhuangg commented 4 years ago

What's the best way to reach you?

I'm attempting to grab all players - it's a bit difficult to make query request when youre unaware of the players id.

Is there anywhere we can get the json file for all players?

cailborg commented 4 years ago

@ynnadkrap looking at tinkering with adding an endpoint for Season Totals...will I need a copy of the database to test this?

Can't get any endpoint to return a value, but not sure if it's just my poor Ruby skills or i'm missing the database.

ynnadkrap commented 4 years ago

There are factories for testing, but you'll need to create a database for it. You should make sure that you have postgresql installed on your machine and run :createdb balldontlie and createdb balldontlie_test.

Then you should write a controller spec for it (look in the spec/ folder to see examples on how to do this). You can run the specs by running rspec.

If you want to test it locally from your laptop, you can email me hello@balldontlie.io and I'll send you a dump that you can load into balldontlie.