Add show table update, add matches list creator

This commit is contained in:
2020-10-31 20:26:47 +01:00
parent 57baee27bd
commit 3a5df3cae6
17 changed files with 195 additions and 32 deletions

View File

@@ -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;
}
}