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<TLWMatch> tlwMatches,
|
||||||
ArrayList<APIFootballMatch> apiFootballMatches)
|
ArrayList<APIFootballMatch> apiFootballMatches)
|
||||||
{
|
{
|
||||||
|
ArrayList<TLWMatch> tlwMatchesCopy = new ArrayList<>(tlwMatches);
|
||||||
for(APIFootballMatch apiFootballMatch : apiFootballMatches) {
|
for(APIFootballMatch apiFootballMatch : apiFootballMatches) {
|
||||||
try {
|
try {
|
||||||
TLWMatch tlwMatch = getMatchingMatch(apiFootballMatch, tlwMatches);
|
TLWMatch tlwMatch = getMatchingMatch(apiFootballMatch, tlwMatchesCopy);
|
||||||
|
tlwMatchesCopy.remove(tlwMatch);
|
||||||
if(tlwMatch == null) {
|
if(tlwMatch == null) {
|
||||||
StatusHolder.setError();
|
StatusHolder.setError();
|
||||||
logger.error("Did not find match to update: " + this.season + ", " + this.league + ", " + tlwMatches.get(0).getMatchday() + ", " + apiFootballMatch.getTeamNameHome() + " - " + apiFootballMatch.getTeamNameGuest());
|
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<TLWMatch> tlwMatches,
|
||||||
ArrayList<APIFootballMatch> apiFootballMatches)
|
ArrayList<APIFootballMatch> apiFootballMatches)
|
||||||
{
|
{
|
||||||
|
ArrayList<TLWMatch> tlwMatchesCopy = new ArrayList<>(tlwMatches);
|
||||||
for(APIFootballMatch apiFootballMatch : apiFootballMatches) {
|
for(APIFootballMatch apiFootballMatch : apiFootballMatches) {
|
||||||
try {
|
try {
|
||||||
TLWMatch tlwMatch = getMatchingMatch(apiFootballMatch, tlwMatches);
|
TLWMatch tlwMatch = getMatchingMatch(apiFootballMatch, tlwMatchesCopy);
|
||||||
|
tlwMatchesCopy.remove(tlwMatch);
|
||||||
tlwMatch.setShowTable(apiFootballMatch.getShowTable());
|
tlwMatch.setShowTable(apiFootballMatch.getShowTable());
|
||||||
} catch (NullPointerException ignored) {
|
} catch (NullPointerException ignored) {
|
||||||
|
|
||||||
@@ -237,9 +241,6 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase {
|
|||||||
matchingMatch = match;
|
matchingMatch = match;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(foundMatches > 1) {
|
|
||||||
logger.error("Found more than one matching matches");
|
|
||||||
}
|
|
||||||
return matchingMatch;
|
return matchingMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user