Change format of matches list to match tlw league configuration
This commit is contained in:
@@ -8,7 +8,7 @@ import org.json.simple.JSONObject;
|
||||
|
||||
public class MatchesListCreator {
|
||||
|
||||
private JSONArray matches;
|
||||
private final JSONObject matches = new JSONObject();
|
||||
private final String country;
|
||||
private final String leagueName;
|
||||
|
||||
@@ -21,10 +21,11 @@ public class MatchesListCreator {
|
||||
JSONObject leagueObject = (JSONObject) firstMatchAPIFootball.get("league");
|
||||
this.country = leagueObject.get("country").toString();
|
||||
this.leagueName = leagueObject.get("name").toString();
|
||||
populateMatches(matchesAPIFootball);
|
||||
JSONArray matches = populateMatches(matchesAPIFootball);
|
||||
this.matches.put("matches", matches);
|
||||
}
|
||||
|
||||
private void populateMatches(JSONArray matchesAPIFootball) {
|
||||
private JSONArray populateMatches(JSONArray matchesAPIFootball) {
|
||||
JSONArray matches = new JSONArray();
|
||||
for(Object matchAPIFootballObject : matchesAPIFootball) {
|
||||
JSONObject matchAPIFootball = (JSONObject) matchAPIFootballObject;
|
||||
@@ -50,10 +51,10 @@ public class MatchesListCreator {
|
||||
match.put("showTable", false);
|
||||
matches.add(match);
|
||||
}
|
||||
this.matches = matches;
|
||||
return matches;
|
||||
}
|
||||
|
||||
public JSONArray getMatches() {
|
||||
public JSONObject getMatches() {
|
||||
return this.matches;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user