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
@@ -14,19 +14,12 @@ import org.apache.logging.log4j.Logger;
*/
public class TLWMatch extends BaseMatch{
public static final Integer STATUS_NOTSTARTED = 0;
public static final Integer STATUS_STARTED = 1;
public static final Integer STATUS_PROVISIONAL_RESULT_AVAILABLE = 2;
public static final Integer STATUS_FINISHED = 3;
public static final Integer STATUS_NOT_EVALUATED = 4;
private Integer season = null;
private Integer league = null;
private Integer matchNo = null;
private String groupId = null;
private String formulaHome = null;
private String formulaGuest = null;
private Integer status = null;
private Integer koMatch = 0;
private Integer showTable = null;
private String trend = null;
@@ -172,10 +165,6 @@ public class TLWMatch extends BaseMatch{
return this.matchNo;
}
public Integer getStatus() {
return this.status;
}
public Integer getKoMatch() {
return this.koMatch;
}
@@ -267,10 +256,6 @@ public class TLWMatch extends BaseMatch{
this.goalsOvertimeGuest = goals;
}
public void setStatus(int status) {
this.status = status;
}
public void setMatchDateTime(String matchDateTime) {
this.matchDatetime = matchDateTime;
}
@@ -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) {