Fix matches results updater

This commit is contained in:
Julian Arndt
2023-08-14 10:03:44 +02:00
parent 2acc6acafe
commit 23cef6f545
9 changed files with 91 additions and 19 deletions
@@ -93,6 +93,7 @@ public class TLWMatchesResultsUpdater extends TLWMatchesManagerBase {
tlwMatch.setUpdateStatus(TLWMatch.COMPARISON_DIFFERENT_RESULT);
}
if(tlwMatch.getKoMatch() == 1 &&
this.betKOType == 2 &&
(!Objects.equals(tlwMatch.getGoalsOvertimeHome(), apiFootballMatch.getGoalsOvertimeHome())
|| !Objects.equals(tlwMatch.getGoalsOvertimeGuest(), apiFootballMatch.getGoalsOvertimeGuest()))
) {
@@ -100,6 +101,29 @@ public class TLWMatchesResultsUpdater extends TLWMatchesManagerBase {
tlwMatch.setGoalsOvertimeGuest(apiFootballMatch.getGoalsOvertimeGuest());
tlwMatch.setUpdateStatus(TLWMatch.COMPARISON_DIFFERENT_RESULT);
}
if(tlwMatch.getKoMatch() == 1 &&
(this.betKOType == 1 || this.betKOType == 3) &&
(apiFootballMatch.getGoalsPenaltyHome() != null) &&
(!Objects.equals(tlwMatch.getGoalsOvertimeHome(), apiFootballMatch.getGoalsPenaltyHome())
|| !Objects.equals(tlwMatch.getGoalsOvertimeGuest(), apiFootballMatch.getGoalsPenaltyGuest()))
) {
tlwMatch.setGoalsOvertimeHome(apiFootballMatch.getGoalsPenaltyHome());
tlwMatch.setGoalsOvertimeGuest(apiFootballMatch.getGoalsPenaltyGuest());
tlwMatch.setUpdateStatus(TLWMatch.COMPARISON_DIFFERENT_RESULT);
}
if(tlwMatch.getKoMatch() == 1 &&
(this.betKOType == 1 || this.betKOType == 3) &&
(apiFootballMatch.getGoalsPenaltyHome() == null) &&
(!Objects.equals(tlwMatch.getGoalsOvertimeHome(), apiFootballMatch.getGoalsOvertimeHome())
|| !Objects.equals(tlwMatch.getGoalsOvertimeGuest(), apiFootballMatch.getGoalsOvertimeGuest()))
) {
tlwMatch.setGoalsOvertimeHome(apiFootballMatch.getGoalsOvertimeHome());
tlwMatch.setGoalsOvertimeGuest(apiFootballMatch.getGoalsOvertimeGuest());
tlwMatch.setUpdateStatus(TLWMatch.COMPARISON_DIFFERENT_RESULT);
}
if(Objects.equals(tlwMatch.getStatus(), TLWMatch.STATUS_PROVISIONAL_RESULT_AVAILABLE)) {
tlwMatch.setUpdateStatus(TLWMatch.COMPARISON_DIFFERENT_RESULT);
}
}
} catch (NullPointerException ignored) {
@@ -120,15 +144,30 @@ public class TLWMatchesResultsUpdater extends TLWMatchesManagerBase {
"Spielnummer " + matchOriginal.getMatchNo() + ", " +
"Spiel '" + TeamIDMatcher.getTeamNameFromTippligaId(matchOriginal.getTeamIdHome()) + "' - '" + TeamIDMatcher.getTeamNameFromTippligaId(matchOriginal.getTeamIdGuest()) + "', ";
if(!Objects.equals(matchOriginal.getGoalsHome(), matchUpdated.getGoalsHome()) || !Objects.equals(matchOriginal.getGoalsGuest(), matchUpdated.getGoalsGuest())) {
if(!Objects.equals(matchOriginal.getGoalsHome(), matchUpdated.getGoalsHome())
|| !Objects.equals(matchOriginal.getGoalsGuest(), matchUpdated.getGoalsGuest())) {
this.beautifulInfo += beautifulInfoStart +
"Ergebnis zu '" + matchUpdated.getGoalsHome() + ":" + matchUpdated.getGoalsGuest() + "'.\n";
}
if(matchOriginal.getKoMatch() == 1 && (!Objects.equals(matchOriginal.getGoalsOvertimeHome(), matchUpdated.getGoalsOvertimeHome()) || !Objects.equals(matchOriginal.getGoalsOvertimeGuest(), matchUpdated.getGoalsOvertimeGuest()))) {
if(matchOriginal.getKoMatch() == 1 && (!Objects.equals(matchOriginal.getGoalsOvertimeHome(), matchUpdated.getGoalsOvertimeHome())
|| !Objects.equals(matchOriginal.getGoalsOvertimeGuest(), matchUpdated.getGoalsOvertimeGuest()))) {
this.beautifulInfo += beautifulInfoStart +
"Ergebnis Nachspielzeit zu '" + matchUpdated.getGoalsOvertimeHome() + ":" + matchUpdated.getGoalsOvertimeGuest() + "'.\n";
}
if(matchOriginal.getStatus().equals(TLWMatch.STATUS_PROVISIONAL_RESULT_AVAILABLE)
&& Objects.equals(matchOriginal.getGoalsHome(), matchUpdated.getGoalsHome())
&& Objects.equals(matchOriginal.getGoalsGuest(), matchUpdated.getGoalsGuest())
&& (matchOriginal.getKoMatch() == 0 || (
matchOriginal.getKoMatch() == 1
&& Objects.equals(matchOriginal.getGoalsOvertimeHome(), matchUpdated.getGoalsOvertimeHome())
&& Objects.equals(matchOriginal.getGoalsOvertimeGuest(), matchUpdated.getGoalsOvertimeGuest())
))
) {
this.beautifulInfo += beautifulInfoStart +
"Ergebnis gespeichert.\n";
}
}
public String getBeautifulInfo() {