diff --git a/src/main/java/de/jeyp91/tippliga/TLWMatchesUpdaterFootball.java b/src/main/java/de/jeyp91/tippliga/TLWMatchesUpdaterFootball.java index 970764d..0773442 100644 --- a/src/main/java/de/jeyp91/tippliga/TLWMatchesUpdaterFootball.java +++ b/src/main/java/de/jeyp91/tippliga/TLWMatchesUpdaterFootball.java @@ -173,9 +173,11 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase { ArrayList tlwMatches, ArrayList apiFootballMatches) { + ArrayList tlwMatchesCopy = new ArrayList<>(tlwMatches); for(APIFootballMatch apiFootballMatch : apiFootballMatches) { try { - TLWMatch tlwMatch = getMatchingMatch(apiFootballMatch, tlwMatches); + TLWMatch tlwMatch = getMatchingMatch(apiFootballMatch, tlwMatchesCopy); + tlwMatchesCopy.remove(tlwMatch); if(tlwMatch == null) { StatusHolder.setError(); logger.error("Did not find match to update: " + this.season + ", " + this.league + ", " + tlwMatches.get(0).getMatchday() + ", " + apiFootballMatch.getTeamNameHome() + " - " + apiFootballMatch.getTeamNameGuest()); @@ -206,9 +208,11 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase { ArrayList tlwMatches, ArrayList apiFootballMatches) { + ArrayList tlwMatchesCopy = new ArrayList<>(tlwMatches); for(APIFootballMatch apiFootballMatch : apiFootballMatches) { try { - TLWMatch tlwMatch = getMatchingMatch(apiFootballMatch, tlwMatches); + TLWMatch tlwMatch = getMatchingMatch(apiFootballMatch, tlwMatchesCopy); + tlwMatchesCopy.remove(tlwMatch); tlwMatch.setShowTable(apiFootballMatch.getShowTable()); } catch (NullPointerException ignored) { @@ -237,9 +241,6 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase { matchingMatch = match; } } - if(foundMatches > 1) { - logger.error("Found more than one matching matches"); - } return matchingMatch; }