Add show table update, add matches list creator
This commit is contained in:
@@ -17,16 +17,28 @@ public class APIFootballMatchesProvider {
|
||||
for (Object singleConfigObject : config) {
|
||||
JSONObject singleConfig = (JSONObject) singleConfigObject;
|
||||
String type = (String) singleConfig.get("type");
|
||||
boolean showTable = false;
|
||||
switch (type) {
|
||||
case "AllMatchesOfMatchday":
|
||||
int matchesLeague = ((Long) singleConfig.get("matchesLeague")).intValue();
|
||||
int leagueMatchday = ((Long) singleConfig.get("leagueMatchday")).intValue();
|
||||
apiFootballMatches.addAll(conn.getMatchDataByLeagueAndMatchday(matchesLeague, leagueMatchday));
|
||||
ArrayList<APIFootballMatch> matches = conn.getMatchDataByLeagueAndMatchday(matchesLeague, leagueMatchday);
|
||||
try {
|
||||
showTable = (boolean) singleConfig.get("showTable");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
boolean finalShowTable = showTable;
|
||||
matches.forEach(apiFootballMatch -> apiFootballMatch.setShowTable(finalShowTable));
|
||||
apiFootballMatches.addAll(matches);
|
||||
break;
|
||||
case "SingleMatch":
|
||||
int matchLeague = ((Long) singleConfig.get("matchLeague")).intValue();
|
||||
int matchId = ((Long) singleConfig.get("matchId")).intValue();
|
||||
apiFootballMatches.add(conn.getMatchDataByLeagueAndMatchID(matchLeague, matchId));
|
||||
APIFootballMatch match = conn.getMatchDataByLeagueAndMatchID(matchLeague, matchId);
|
||||
showTable = (boolean) singleConfig.get("showTable");
|
||||
match.setShowTable(showTable);
|
||||
apiFootballMatches.add(match);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user