Search in sources :

Example 6 with DistrictRanking

use of com.thebluealliance.androidclient.models.DistrictRanking in project the-blue-alliance-android by the-blue-alliance.

the class DistrictTeamExtractorTest method testDistrictTeamExtractorNotFound.

@Test
public void testDistrictTeamExtractorNotFound() {
    mExtractor = new DistrictTeamExtractor(mNotFoundTeamKey);
    DistrictRanking extracted = mExtractor.call(mDistrictTeams);
    assertNull(extracted);
}
Also used : DistrictRanking(com.thebluealliance.androidclient.models.DistrictRanking) Test(org.junit.Test)

Example 7 with DistrictRanking

use of com.thebluealliance.androidclient.models.DistrictRanking in project the-blue-alliance-android by the-blue-alliance.

the class DistrictRankingsSubscriber method parseData.

@Override
public void parseData() {
    mDataToBind.clear();
    for (int i = 0; i < mAPIData.size(); i++) {
        DistrictRanking districtTeam = mAPIData.get(i);
        Team teamData = mDb.getTeamsTable().get(districtTeam.getTeamKey());
        String nickname;
        if (teamData != null) {
            nickname = teamData.getNickname();
        } else {
            TbaLogger.w("Couldn't find " + districtTeam.getTeamKey() + " in db");
            nickname = "Team " + districtTeam.getTeamKey().substring(3);
        }
        mDataToBind.add(new DistrictTeamListElement(districtTeam.getTeamKey(), districtTeam.getDistrictKey(), nickname, districtTeam.getRank(), districtTeam.getPointTotal()));
    }
}
Also used : Team(com.thebluealliance.androidclient.models.Team) DistrictTeamListElement(com.thebluealliance.androidclient.listitems.DistrictTeamListElement) DistrictRanking(com.thebluealliance.androidclient.models.DistrictRanking)

Example 8 with DistrictRanking

use of com.thebluealliance.androidclient.models.DistrictRanking in project the-blue-alliance-android by the-blue-alliance.

the class AddDistrictTeamKey method call.

@Override
public List<DistrictRanking> call(List<DistrictRanking> districtTeams) {
    if (districtTeams == null)
        return null;
    for (int i = 0; i < districtTeams.size(); i++) {
        DistrictRanking dt = districtTeams.get(i);
        String dtKey;
        dtKey = DistrictTeamHelper.generateKey(dt.getTeamKey(), districtKey);
        dt.setKey(dtKey);
        dt.setDistrictKey(districtKey);
    }
    return districtTeams;
}
Also used : DistrictRanking(com.thebluealliance.androidclient.models.DistrictRanking)

Aggregations

DistrictRanking (com.thebluealliance.androidclient.models.DistrictRanking)8 Test (org.junit.Test)4 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)1 JsonObject (com.google.gson.JsonObject)1 DistrictTeamListElement (com.thebluealliance.androidclient.listitems.DistrictTeamListElement)1 Team (com.thebluealliance.androidclient.models.Team)1 IDistrictEventPoints (com.thebluealliance.api.model.IDistrictEventPoints)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1