Add support for mulitple identical matches like WTL Pokal final
This commit is contained in:
@@ -173,9 +173,11 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase {
|
||||
ArrayList<TLWMatch> tlwMatches,
|
||||
ArrayList<APIFootballMatch> apiFootballMatches)
|
||||
{
|
||||
ArrayList<TLWMatch> 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<TLWMatch> tlwMatches,
|
||||
ArrayList<APIFootballMatch> apiFootballMatches)
|
||||
{
|
||||
ArrayList<TLWMatch> 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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user