Add auto update of results

This commit is contained in:
2023-06-06 15:48:06 +02:00
parent 8cc7602709
commit 0f67a1de05
13 changed files with 275 additions and 74 deletions
@@ -220,30 +220,6 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase {
}
}
private TLWMatch getMatchingMatch(APIFootballMatch apiFootballMatch, ArrayList<TLWMatch> tlwMatches) throws NullPointerException{
int foundMatches = 0;
TLWMatch matchingMatch = null;
for(TLWMatch match : tlwMatches) {
Integer apiTeamIdHome = TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch, TeamIDMatcher.HOME);
Integer apiTeamIdGuest = TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch, TeamIDMatcher.GUEST);
int tlwTeamIdHome = match.getTeamIdHome();
int tlwTeamIdGuest = match.getTeamIdGuest();
if(apiTeamIdHome == null
|| apiTeamIdGuest == null) {
throw new NullPointerException();
}
if(
apiTeamIdHome.equals(tlwTeamIdHome)
&& apiTeamIdGuest.equals(tlwTeamIdGuest)
) {
foundMatches++;
matchingMatch = match;
}
}
return matchingMatch;
}
public ArrayList<TLWMatch> getTLWMatchesUpdated() {
return this.tlwMatchesUpdated;
}