diff --git a/src/main/java/com/ko/footballupdater/datasource/FbrefDataSource.java b/src/main/java/com/ko/footballupdater/datasource/FbrefDataSource.java index 5f721f4..9621d5e 100644 --- a/src/main/java/com/ko/footballupdater/datasource/FbrefDataSource.java +++ b/src/main/java/com/ko/footballupdater/datasource/FbrefDataSource.java @@ -85,12 +85,17 @@ public PlayerMatchPerformanceStats parsePlayerMatchData(Player player, Document return null; } - if (player.getCheckedStatus() == null || - (player.getCheckedStatus().getLatestCheckedMatchUrl() != null && player.getCheckedStatus().getLatestCheckedMatchUrl().equals(latestMatchUrl)) || - (player.getCheckedStatus().getLatestCheckedMatchDate() != null && !(selectedMatchDate.compareTo(player.getCheckedStatus().getLatestCheckedMatchDate()) > 0)) - ) { - // No new updates - log.atInfo().setMessage(player.getName() + " " + "latestMatchUrl matches last checked").addKeyValue("player", player.getName()).log(); + if (player.getCheckedStatus() != null) { + if (player.getCheckedStatus().getLatestCheckedMatchDate() != null && !(selectedMatchDate.compareTo(player.getCheckedStatus().getLatestCheckedMatchDate()) > 0)) { + log.atInfo().setMessage(player.getName() + " - Selected match is not newer than last checked").addKeyValue("player", player.getName()).log(); + return null; + } else if (player.getCheckedStatus().getLatestCheckedMatchUrl() != null && player.getCheckedStatus().getLatestCheckedMatchUrl().equals(latestMatchUrl)) { + // No new updates + log.atInfo().setMessage(player.getName() + " - latestMatchUrl matches last checked").addKeyValue("player", player.getName()).log(); + return null; + } + } else { + log.atInfo().setMessage(player.getName() + " - CheckedStatus is null").addKeyValue("player", player.getName()).log(); return null; } diff --git a/src/main/java/com/ko/footballupdater/services/TeamService.java b/src/main/java/com/ko/footballupdater/services/TeamService.java index f2facae..d2ed16a 100644 --- a/src/main/java/com/ko/footballupdater/services/TeamService.java +++ b/src/main/java/com/ko/footballupdater/services/TeamService.java @@ -1,7 +1,6 @@ package com.ko.footballupdater.services; import com.ko.footballupdater.models.CheckedStatus; -import com.ko.footballupdater.models.DataSourceSiteName; import com.ko.footballupdater.models.Player; import com.ko.footballupdater.models.Team; import com.ko.footballupdater.repositories.PlayerRepository;