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) { 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); TLWMatch tlwMatch = getMatchingMatch(apiFootballMatch, tlwMatches);
if(tlwMatch == null) { if(tlwMatch == null) {
StatusHolder.setError(); 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)); tlwMatch.setMatchDateTime(apiFootballMatch.getMatchDateTime().replace("T", " ").substring(0, 19));
} }
@@ -210,13 +210,16 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase {
for(TLWMatch match : tlwMatches) { for(TLWMatch match : tlwMatches) {
Integer apiTeamIdHome = TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch, TeamIDMatcher.HOME); Integer apiTeamIdHome = TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch, TeamIDMatcher.HOME);
Integer apiTeamIdGuest = TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch, TeamIDMatcher.GUEST); Integer apiTeamIdGuest = TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch, TeamIDMatcher.GUEST);
int tlwTeamIdHome = match.getTeamIdHome();
int tlwTeamIdGuest = match.getTeamIdGuest();
if(apiTeamIdHome == null if(apiTeamIdHome == null
|| apiTeamIdGuest == null) { || apiTeamIdGuest == null) {
throw new NullPointerException(); throw new NullPointerException();
} }
if( if(
apiTeamIdHome == match.getTeamIdHome() apiTeamIdHome.equals(tlwTeamIdHome)
&& apiTeamIdGuest == match.getTeamIdGuest() && apiTeamIdGuest.equals(tlwTeamIdGuest)
) { ) {
foundMatches++; foundMatches++;
matchingMatch = match; matchingMatch = match;