widavies / TBA-API-V2

A Java API for pulling robotics data from www.thebluealliance.com.
5 stars 0 forks source link

Issues with rankings and Rankings Related Data #11

Closed Techno11 closed 7 years ago

Techno11 commented 7 years ago

Event e = tba.getEvent(eventKey, year); for(Team team : e.teams){ if(team.team_number == teamNumber){ break; } i++; } Team tr = e.teams[i]; System.out.print(tr.rank); System.out.print(tr.rankingScore);

When printing ranking data, I get a 0, however when printing any other data I get the correct response (moto, name, etc). Is there something I am doing wrong?

widavies commented 7 years ago

Make sure this setting is enabled:

Settings.FIND_TEAM_RANKINGS = true;

Techno11 commented 7 years ago

Ok. I see what I did wrong. Thanks

Techno11 commented 7 years ago

Still having problems, even with recommended fixes. teamNumber = 1322; Event e = tba.getEvent(eventKey, year); int i = 0; int rank = 0; double auto = 0; double goals = 0; double rankScore = 0; double defences = 0; int playedMatches = 0; double scaleChallenge = 0; String record = "Unavaliable";

for(Team team : e.teams){ if(team.team_number == teamNumber){ rank = team.rank; System.out.println(team.team_number); auto = team.auto; goals = team.goals; rankScore = team.rankingScore; defences = team.defense; playedMatches = team.played; scaleChallenge = team.scaleOrChallenge; record = team.record; break; } i++; } I probably am still doing something wrong? Still get 0 for rank, however I get the proper team number when doing team.team_number;

widavies commented 7 years ago

Quick question, are you pulling a 2017 event?

Techno11 commented 7 years ago

Yes

widavies commented 7 years ago

Alright, so if that event hasn't occurred yet, scoring / ranking data can't be pulled, since no match data is available on the blue alliance.com. Are you pulling an event that hasn't started yet?

Techno11 commented 7 years ago

No, I am pulling data from 2017 miket. I tried during the event and afterwards.

widavies commented 7 years ago

Okay, so it's my bad. There is was a bug in the ranking parsing thing, plus the new 2017 items the server returns are a bit weird. You'll have to play around with it a bit and let me know if anything else isn't working. I got ranks and scoring working however. Go ahead and download a new .jar here: https://github.com/techguy9984/TBA-API/releases/tag/6