Update database only if matchday is in future

This commit is contained in:
2020-10-31 20:51:56 +01:00
parent 53af82a429
commit 7d9fc5aac1
2 changed files with 12 additions and 4 deletions

View File

@@ -51,10 +51,18 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase {
logger.error("Not matching config!");
}
LocalDateTime now = LocalDateTime.now();
LocalDateTime firstMatchOriginal = TLWMatchesManagerBase.getFirstMatchtimeTLW(tlwMatchesOriginalMatchday);
LocalDateTime firstMatchUpdated = TLWMatchesManagerBase.getFirstMatchtimeAPIFootball(apiFootballMatches);
if(apiFootballMatches.size() > 0
&& now.isBefore(firstMatchOriginal)
&& now.isBefore(firstMatchUpdated)) {
addMissingMatches(tlwMatchesUpdatedMatchday, apiFootballMatches);
updateMatchDateTimes(tlwMatchesUpdatedMatchday, apiFootballMatches);
updateShowTable(tlwMatchesUpdatedMatchday, apiFootballMatches);
updateStatus(tlwMatchesUpdatedMatchday);
}
this.tlwMatchesOriginal.addAll(tlwMatchesOriginalMatchday);
this.tlwMatchesUpdated.addAll(tlwMatchesUpdatedMatchday);

Binary file not shown.