Add auto update of results
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package de.jeyp91.tippliga;
|
||||
|
||||
import de.jeyp91.apifootball.APIFootballMatch;
|
||||
import de.jeyp91.teamidmatcher.TeamIDMatcher;
|
||||
import de.jeyp91.tippligaforum.TippligaConfigProvider;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
@@ -100,4 +101,28 @@ public class TLWMatchesManagerBase {
|
||||
date2 = date2.toLocalDate().atTime(0, 0, 0);
|
||||
return (int) date1.until(date2, ChronoUnit.DAYS);
|
||||
}
|
||||
|
||||
protected 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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user