Various fixes for empty Relegation
This commit is contained in:
@@ -117,6 +117,18 @@ public class TLWMatch extends BaseMatch{
|
||||
this.matchDatetime = matchDatetime;
|
||||
}
|
||||
|
||||
public TLWMatch(int season, int league, int matchday, int matchNo, int status, int koMatch, String formulaHome, String formulaGuest, String matchDatetime) {
|
||||
this.season = season;
|
||||
this.matchday = matchday;
|
||||
this.league = league;
|
||||
this.matchNo = matchNo;
|
||||
this.status = status;
|
||||
this.koMatch = koMatch;
|
||||
this.formulaHome = formulaHome;
|
||||
this.formulaGuest = formulaGuest;
|
||||
this.matchDatetime = matchDatetime;
|
||||
}
|
||||
|
||||
public TLWMatch(int season, int league, int matchday, int matchNo, int teamIdHome, int teamIdGuest, String matchDatetime, int koMatch) {
|
||||
this.season = season;
|
||||
this.matchday = matchday;
|
||||
|
||||
@@ -22,7 +22,7 @@ public class TLWMatchdaysCreator {
|
||||
this.season = season;
|
||||
this.league = league;
|
||||
|
||||
TLWMatchesCreatorFootball matchesCreator = new TLWMatchesCreatorFootball(season, 1, configPath);
|
||||
TLWMatchesCreatorFootball matchesCreator = new TLWMatchesCreatorFootball(season, league, configPath);
|
||||
this.matches = matchesCreator.getMatches();
|
||||
|
||||
TippligaConfigProvider prov = new TippligaConfigProvider(season);
|
||||
|
||||
@@ -69,6 +69,20 @@ public class TLWMatchesCreatorFootball extends TLWMatchesCreatorBase {
|
||||
}
|
||||
}
|
||||
|
||||
// Add PlaceholderSingleMatch matches
|
||||
for (Object matchesConfigObject : matchesConfig) {
|
||||
JSONObject singleMatchConfig = (JSONObject) matchesConfigObject;
|
||||
if(singleMatchConfig.get("type").equals("PlaceholderSingleMatch")) {
|
||||
String formulaHome = (String) singleMatchConfig.get("formulaHome");
|
||||
String formulaGuest = (String) singleMatchConfig.get("formulaGuest");
|
||||
String matchDatetime = (String) singleMatchConfig.get("placeholderDatetime");
|
||||
int matchNo = this.nextMatchNo;
|
||||
this.nextMatchNo++;
|
||||
this.TLWMatches.add(new TLWMatch(this.season, this.league, TLWMatchday, matchNo, 0, this.ko, formulaHome, formulaGuest, matchDatetime));
|
||||
matchdayMatchCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
// Add empty missing matches
|
||||
int matchesPerMatchdayTemp = 0;
|
||||
if(this.matchesPerMatchday != 0) {
|
||||
|
||||
@@ -44,6 +44,10 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase {
|
||||
|
||||
ArrayList<APIFootballMatch> apiFootballMatches = apiFootballMatchesProvider.getAPIFootballMatchesFromConfig((JSONObject) singleMatchdayConfig);
|
||||
|
||||
if(apiFootballMatches.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ArrayList<TLWMatch> tlwMatchesOriginalMatchday = tippligaSQLConnector.getMatches(String.valueOf(this.season), String.valueOf(this.league), String.valueOf(tlwMatchday));
|
||||
ArrayList<TLWMatch> tlwMatchesUpdatedMatchday = new ArrayList<>();
|
||||
for (TLWMatch match : tlwMatchesOriginalMatchday) {
|
||||
@@ -58,9 +62,7 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase {
|
||||
LocalDateTime firstMatchOriginal = TLWMatchesManagerBase.getFirstMatchtimeTLW(tlwMatchesOriginalMatchday);
|
||||
LocalDateTime firstMatchUpdated = TLWMatchesManagerBase.getFirstMatchtimeAPIFootball(apiFootballMatches);
|
||||
|
||||
if(apiFootballMatches.size() > 0
|
||||
&& now.isBefore(firstMatchOriginal)
|
||||
&& now.isBefore(firstMatchUpdated)) {
|
||||
if(now.isBefore(firstMatchOriginal) && now.isBefore(firstMatchUpdated)) {
|
||||
addMissingMatches(tlwMatchesUpdatedMatchday, apiFootballMatches);
|
||||
updateMatchDateTimes(tlwMatchesUpdatedMatchday, apiFootballMatches);
|
||||
updateShowTable(tlwMatchesUpdatedMatchday, apiFootballMatches);
|
||||
|
||||
Reference in New Issue
Block a user