Change format of matches list to match tlw league configuration

This commit is contained in:
Julian Arndt
2020-11-10 11:02:30 +01:00
parent c53511939d
commit f1ce35dcdf
3 changed files with 9 additions and 8 deletions

View File

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

View File

@@ -9,7 +9,7 @@ public class MatchesListCreatorTest {
public void getMatchesTest2664() {
MatchesListCreator creator = new MatchesListCreator(2664);
String matches = creator.getMatchesBeautiful();
System.out.println(matches);
// System.out.println(matches);
}
@Test

View File

@@ -10,12 +10,12 @@ public class MatchesListForumUpdaterTest {
@Test
public void updateAllLeaguesTest() {
MatchesListForumUpdater updater = new MatchesListForumUpdater();
updater.updateAllLeagues();
// updater.updateAllLeagues();
}
@Test
public void updateLeagueTest() {
MatchesListForumUpdater updater = new MatchesListForumUpdater();
updater.updateLeague(2755);
// updater.updateLeague(2743);
}
}