Only update result if api football match is finished

This commit is contained in:
Julian Arndt
2023-08-20 11:55:53 +02:00
parent 29f00f39aa
commit b411f5d57f
4 changed files with 48 additions and 37 deletions
@@ -56,7 +56,7 @@ public class TLWMatchesResultsUpdater extends TLWMatchesManagerBase {
}
updateBeautifulInfo(tlwMatchesOriginalMatchday, tlwMatchesUpdatedMatchday);
tlwMatchesUpdatedMatchday.removeIf(tlwMatch -> tlwMatch.getUpdateStatus() != TLWMatch.COMPARISON_DIFFERENT_RESULT);
tlwMatchesUpdatedMatchday.removeIf(tlwMatch -> tlwMatch.getUpdateStatus() != TLWMatch.COMPARISON.DIFFERENT_RESULT);
if(tlwMatchesUpdatedMatchday.size() > 0) this.tlwMatchesUpdated.add(tlwMatchesUpdatedMatchday);
}
}
@@ -82,15 +82,13 @@ public class TLWMatchesResultsUpdater extends TLWMatchesManagerBase {
try {
TLWMatch tlwMatch = getMatchingMatch(apiFootballMatch, tlwMatchesCopy);
tlwMatchesCopy.remove(tlwMatch);
if(Objects.equals(tlwMatch.getStatus(), TLWMatch.STATUS_STARTED)
|| Objects.equals(tlwMatch.getStatus(), TLWMatch.STATUS_PROVISIONAL_RESULT_AVAILABLE)
|| Objects.equals(tlwMatch.getStatus(), TLWMatch.STATUS_FINISHED)) {
if(Objects.equals(apiFootballMatch.getStatus(), TLWMatch.STATUS_FINISHED)) {
if(!Objects.equals(tlwMatch.getGoalsHome(), apiFootballMatch.getGoalsHome())
|| !Objects.equals(tlwMatch.getGoalsGuest(), apiFootballMatch.getGoalsGuest())
) {
tlwMatch.setGoalsHome(apiFootballMatch.getGoalsHome());
tlwMatch.setGoalsGuest(apiFootballMatch.getGoalsGuest());
tlwMatch.setUpdateStatus(TLWMatch.COMPARISON_DIFFERENT_RESULT);
tlwMatch.setUpdateStatus(TLWMatch.COMPARISON.DIFFERENT_RESULT);
}
if(tlwMatch.getKoMatch() == 1 &&
this.betKOType == 2 &&
@@ -99,7 +97,7 @@ public class TLWMatchesResultsUpdater extends TLWMatchesManagerBase {
) {
tlwMatch.setGoalsOvertimeHome(apiFootballMatch.getGoalsOvertimeHome());
tlwMatch.setGoalsOvertimeGuest(apiFootballMatch.getGoalsOvertimeGuest());
tlwMatch.setUpdateStatus(TLWMatch.COMPARISON_DIFFERENT_RESULT);
tlwMatch.setUpdateStatus(TLWMatch.COMPARISON.DIFFERENT_RESULT);
}
if(tlwMatch.getKoMatch() == 1 &&
(this.betKOType == 1 || this.betKOType == 3) &&
@@ -109,7 +107,7 @@ public class TLWMatchesResultsUpdater extends TLWMatchesManagerBase {
) {
tlwMatch.setGoalsOvertimeHome(apiFootballMatch.getGoalsPenaltyHome());
tlwMatch.setGoalsOvertimeGuest(apiFootballMatch.getGoalsPenaltyGuest());
tlwMatch.setUpdateStatus(TLWMatch.COMPARISON_DIFFERENT_RESULT);
tlwMatch.setUpdateStatus(TLWMatch.COMPARISON.DIFFERENT_RESULT);
}
if(tlwMatch.getKoMatch() == 1 &&
(this.betKOType == 1 || this.betKOType == 3) &&
@@ -119,10 +117,10 @@ public class TLWMatchesResultsUpdater extends TLWMatchesManagerBase {
) {
tlwMatch.setGoalsOvertimeHome(apiFootballMatch.getGoalsOvertimeHome());
tlwMatch.setGoalsOvertimeGuest(apiFootballMatch.getGoalsOvertimeGuest());
tlwMatch.setUpdateStatus(TLWMatch.COMPARISON_DIFFERENT_RESULT);
tlwMatch.setUpdateStatus(TLWMatch.COMPARISON.DIFFERENT_RESULT);
}
if(Objects.equals(tlwMatch.getStatus(), TLWMatch.STATUS_PROVISIONAL_RESULT_AVAILABLE)) {
tlwMatch.setUpdateStatus(TLWMatch.COMPARISON_DIFFERENT_RESULT);
tlwMatch.setUpdateStatus(TLWMatch.COMPARISON.DIFFERENT_RESULT);
}
}
} catch (NullPointerException ignored) {