Fix small comparison issue and improve error messages

This commit is contained in:
2020-11-04 21:51:14 +01:00
parent 7e09e96cb1
commit fbbac7fdb0

View File

@@ -160,7 +160,7 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase {
}
}
if(!done) {
logger.error("Could not add missing match");
logger.error("Could not add missing match: " + this.season + ", " + this.league + ", " + tlwMatches.get(0).getMatchday() + ", " + missingMatch.getTeamNameHome() + " - " + missingMatch.getTeamNameGuest());
}
}
}
@@ -173,7 +173,7 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase {
TLWMatch tlwMatch = getMatchingMatch(apiFootballMatch, tlwMatches);
if(tlwMatch == null) {
StatusHolder.setError();
logger.error("Did not find match to update");
logger.error("Did not find match to update: " + this.season + ", " + this.league + ", " + tlwMatches.get(0).getMatchday() + ", " + apiFootballMatch.getTeamNameHome() + " - " + apiFootballMatch.getTeamNameGuest());
}
tlwMatch.setMatchDateTime(apiFootballMatch.getMatchDateTime().replace("T", " ").substring(0, 19));
}
@@ -210,13 +210,16 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase {
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 == match.getTeamIdHome()
&& apiTeamIdGuest == match.getTeamIdGuest()
apiTeamIdHome.equals(tlwTeamIdHome)
&& apiTeamIdGuest.equals(tlwTeamIdGuest)
) {
foundMatches++;
matchingMatch = match;