From b388fbd01ba868a193340d93ff241257cb8a6ec4 Mon Sep 17 00:00:00 2001 From: Soren Zaiser Date: Sat, 22 Dec 2018 14:18:35 -0500 Subject: [PATCH] added an additional check --- .../datasync/tabs/TeamsController.java | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/org/theorangealliance/datasync/tabs/TeamsController.java b/src/org/theorangealliance/datasync/tabs/TeamsController.java index 6fd57cc..2a50703 100644 --- a/src/org/theorangealliance/datasync/tabs/TeamsController.java +++ b/src/org/theorangealliance/datasync/tabs/TeamsController.java @@ -188,15 +188,24 @@ public void getTeamsFromFIRSTApi() { teamsEndpoint.execute(((toaR, toaS) -> { if (toaS) { TeamJSON[] team = teamsEndpoint.getGson().fromJson(toaR, TeamJSON[].class); - Team eventTeam = new Team( - team[0].getTeamKey(), - 1, - team[0].getTeamRegionKey(), - team[0].getTeamLeagueKey(), - team[0].getTeamNameShort(), - team[0].getTeamNameLong(), - team[0].getTeamCity() + ", " + team[0].getTeamCity() + ", " + team[0].getTeamCountry()); + if(team.length == 1){ + Team eventTeam = new Team( + team[0].getTeamKey(), + 1, + team[0].getTeamRegionKey(), + team[0].getTeamLeagueKey(), + team[0].getTeamNameShort(), + team[0].getTeamNameLong(), + team[0].getTeamCity() + ", " + team[0].getTeamCity() + ", " + team[0].getTeamCountry()); teamsList.add(eventTeam); + } else { + Alert alert = new Alert(Alert.AlertType.ERROR); + alert.setTitle("Error"); + alert.setHeaderText("Non-Existant Team"); + alert.setContentText("This team is not on TOA, and therefore, must not have been registered in TIMS. Please contact contact@theorangealliance.org soon so we can manually add the team."); + + alert.showAndWait(); + } } else { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("Error");