Add several improvements for EM
This commit is contained in:
@@ -12,9 +12,15 @@ public class APIFootballMatchesProvider {
|
||||
this.conn = APIFootballConnector.getAPIFootballConnectorInstance(season - 1);
|
||||
}
|
||||
|
||||
public ArrayList<APIFootballMatch> getAPIFootballMatchesFromConfig(JSONArray config) {
|
||||
public ArrayList<APIFootballMatch> getAPIFootballMatchesFromConfig(JSONObject matchdayConfig) {
|
||||
boolean ko = false;
|
||||
try {
|
||||
ko = (boolean) matchdayConfig.get("ko");
|
||||
} catch (Exception e) {
|
||||
// Nothing to do here
|
||||
}
|
||||
ArrayList<APIFootballMatch> apiFootballMatches = new ArrayList<>();
|
||||
for (Object singleConfigObject : config) {
|
||||
for (Object singleConfigObject : (JSONArray) matchdayConfig.get("matchesConfig")) {
|
||||
JSONObject singleConfig = (JSONObject) singleConfigObject;
|
||||
String type = (String) singleConfig.get("type");
|
||||
boolean showTable = false;
|
||||
@@ -29,7 +35,11 @@ public class APIFootballMatchesProvider {
|
||||
e.printStackTrace();
|
||||
}
|
||||
boolean finalShowTable = showTable;
|
||||
matches.forEach(apiFootballMatch -> apiFootballMatch.setShowTable(finalShowTable));
|
||||
boolean finalKo = ko;
|
||||
matches.forEach(apiFootballMatch -> {
|
||||
apiFootballMatch.setShowTable(finalShowTable);
|
||||
apiFootballMatch.setKoMatch(finalKo);
|
||||
});
|
||||
apiFootballMatches.addAll(matches);
|
||||
break;
|
||||
case "SingleMatch":
|
||||
@@ -38,6 +48,7 @@ public class APIFootballMatchesProvider {
|
||||
APIFootballMatch match = conn.getMatchDataByLeagueAndMatchID(matchLeague, matchId);
|
||||
showTable = (boolean) singleConfig.get("showTable");
|
||||
match.setShowTable(showTable);
|
||||
match.setKoMatch(ko);
|
||||
apiFootballMatches.add(match);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user