From 7d9fc5aac1d29d5785c75b2f561f6721e3b4413e Mon Sep 17 00:00:00 2001 From: Julian Arndt Date: Sat, 31 Oct 2020 20:51:56 +0100 Subject: [PATCH] Update database only if matchday is in future --- .../tippliga/TLWMatchesUpdaterFootball.java | 16 ++++++++++++---- tokens/StoredCredential | Bin 1081 -> 1081 bytes 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/jeyp91/tippliga/TLWMatchesUpdaterFootball.java b/src/main/java/de/jeyp91/tippliga/TLWMatchesUpdaterFootball.java index 2082031..1fc96bd 100644 --- a/src/main/java/de/jeyp91/tippliga/TLWMatchesUpdaterFootball.java +++ b/src/main/java/de/jeyp91/tippliga/TLWMatchesUpdaterFootball.java @@ -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); diff --git a/tokens/StoredCredential b/tokens/StoredCredential index c5c7e158f4735842db24d333fde841817b327fc9..99ee11e8baa469d1384425df36a38117e60eb577 100644 GIT binary patch delta 190 zcmdnVv6Ev%1Y^CEQ@N{mWPn?whqGb6iFu%7ey+2BPEKfKWpZ|?iIa(?S9-p;Ykq*g zS(K-Rn`x+{Z&5{JRDbC7{kq>Eo}S-4+7l98!@RzSLW zfpK^XK;B%mT#J6NpMzK qR=%5AMsQ(dysm+vd1c1r?~L9Y4RQZh6c;gQO#aWLvAKxpI3oaAi9nA4 delta 190 zcmdnVv6Ev%1Y^BpiBV9Fmxp=0X?Ti%gkxHgWvZv8Nr`E>S*fwRr;(G9sj*>tVVJLZ zxpAmhaZ*WGsBV$2x3_b$pNFr1xs$6|g=c*~JsY!ZjNJe2{MzV8RmAOwyVv>TVf3|yRdai|=lTlHildE%{ qpSNeFt7mFvvT>M4kg?C??~L9YiSxdlD=uQtnEanfV{;MHaYg`zqCpe@