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!");
|
logger.error("Not matching config!");
|
||||||
}
|
}
|
||||||
|
|
||||||
addMissingMatches(tlwMatchesUpdatedMatchday, apiFootballMatches);
|
LocalDateTime now = LocalDateTime.now();
|
||||||
updateMatchDateTimes(tlwMatchesUpdatedMatchday, apiFootballMatches);
|
LocalDateTime firstMatchOriginal = TLWMatchesManagerBase.getFirstMatchtimeTLW(tlwMatchesOriginalMatchday);
|
||||||
updateShowTable(tlwMatchesUpdatedMatchday, apiFootballMatches);
|
LocalDateTime firstMatchUpdated = TLWMatchesManagerBase.getFirstMatchtimeAPIFootball(apiFootballMatches);
|
||||||
updateStatus(tlwMatchesUpdatedMatchday);
|
|
||||||
|
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.tlwMatchesOriginal.addAll(tlwMatchesOriginalMatchday);
|
||||||
this.tlwMatchesUpdated.addAll(tlwMatchesUpdatedMatchday);
|
this.tlwMatchesUpdated.addAll(tlwMatchesUpdatedMatchday);
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user