Update database only if matchday is in future
This commit is contained in:
@@ -51,10 +51,18 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase {
|
||||
logger.error("Not matching config!");
|
||||
}
|
||||
|
||||
addMissingMatches(tlwMatchesUpdatedMatchday, apiFootballMatches);
|
||||
updateMatchDateTimes(tlwMatchesUpdatedMatchday, apiFootballMatches);
|
||||
updateShowTable(tlwMatchesUpdatedMatchday, apiFootballMatches);
|
||||
updateStatus(tlwMatchesUpdatedMatchday);
|
||||
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.
Reference in New Issue
Block a user