Fix matches results updater
This commit is contained in:
@@ -28,8 +28,6 @@ public class TLWMatch extends BaseMatch{
|
||||
private String formulaGuest = null;
|
||||
private Integer status = null;
|
||||
private Integer koMatch = 0;
|
||||
private Integer goalsOvertimeHome = null;
|
||||
private Integer goalsOvertimeGuest = null;
|
||||
private Integer showTable = null;
|
||||
private String trend = null;
|
||||
private Float odd1 = null;
|
||||
|
||||
@@ -18,6 +18,7 @@ public class TLWMatchesManagerBase {
|
||||
protected int numberOfMatchdays;
|
||||
protected int matchesPerMatchday;
|
||||
protected int ko;
|
||||
protected int betKOType;
|
||||
|
||||
protected JSONArray matchdayConfig;
|
||||
|
||||
@@ -28,6 +29,8 @@ public class TLWMatchesManagerBase {
|
||||
this.numberOfMatchdays = ((Long) config.get("numberOfMatchdays")).intValue();
|
||||
this.matchdayConfig = (JSONArray) config.get("matchdayConfig");
|
||||
this.ko = ((Long) config.get("ko")).intValue();
|
||||
Long parsedBetKOType = (Long) config.get("betKOType");
|
||||
this.betKOType = parsedBetKOType == null ? 1 : parsedBetKOType.intValue();
|
||||
}
|
||||
|
||||
public static ArrayList<TLWMatch> getMatchesStartingFromSecondDay(ArrayList<TLWMatch> matches) {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user