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 {
|
public class MatchesListCreator {
|
||||||
|
|
||||||
private JSONArray matches;
|
private final JSONObject matches = new JSONObject();
|
||||||
private final String country;
|
private final String country;
|
||||||
private final String leagueName;
|
private final String leagueName;
|
||||||
|
|
||||||
@@ -21,10 +21,11 @@ public class MatchesListCreator {
|
|||||||
JSONObject leagueObject = (JSONObject) firstMatchAPIFootball.get("league");
|
JSONObject leagueObject = (JSONObject) firstMatchAPIFootball.get("league");
|
||||||
this.country = leagueObject.get("country").toString();
|
this.country = leagueObject.get("country").toString();
|
||||||
this.leagueName = leagueObject.get("name").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();
|
JSONArray matches = new JSONArray();
|
||||||
for(Object matchAPIFootballObject : matchesAPIFootball) {
|
for(Object matchAPIFootballObject : matchesAPIFootball) {
|
||||||
JSONObject matchAPIFootball = (JSONObject) matchAPIFootballObject;
|
JSONObject matchAPIFootball = (JSONObject) matchAPIFootballObject;
|
||||||
@@ -50,10 +51,10 @@ public class MatchesListCreator {
|
|||||||
match.put("showTable", false);
|
match.put("showTable", false);
|
||||||
matches.add(match);
|
matches.add(match);
|
||||||
}
|
}
|
||||||
this.matches = matches;
|
return matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONArray getMatches() {
|
public JSONObject getMatches() {
|
||||||
return this.matches;
|
return this.matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ public class MatchesListCreatorTest {
|
|||||||
public void getMatchesTest2664() {
|
public void getMatchesTest2664() {
|
||||||
MatchesListCreator creator = new MatchesListCreator(2664);
|
MatchesListCreator creator = new MatchesListCreator(2664);
|
||||||
String matches = creator.getMatchesBeautiful();
|
String matches = creator.getMatchesBeautiful();
|
||||||
System.out.println(matches);
|
// System.out.println(matches);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ public class MatchesListForumUpdaterTest {
|
|||||||
@Test
|
@Test
|
||||||
public void updateAllLeaguesTest() {
|
public void updateAllLeaguesTest() {
|
||||||
MatchesListForumUpdater updater = new MatchesListForumUpdater();
|
MatchesListForumUpdater updater = new MatchesListForumUpdater();
|
||||||
updater.updateAllLeagues();
|
// updater.updateAllLeagues();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updateLeagueTest() {
|
public void updateLeagueTest() {
|
||||||
MatchesListForumUpdater updater = new MatchesListForumUpdater();
|
MatchesListForumUpdater updater = new MatchesListForumUpdater();
|
||||||
updater.updateLeague(2755);
|
// updater.updateLeague(2743);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user