Add several improvements for EM

This commit is contained in:
2024-06-08 00:12:59 +02:00
parent 10b5cc2f9c
commit 1889be5b14
10 changed files with 215 additions and 57 deletions

View File

@@ -2,12 +2,11 @@ package de.jeyp91.tippliga;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Objects;
import de.jeyp91.BaseMatch;
import de.jeyp91.teamidmatcher.TeamIDMatcher;
import de.jeyp91.apifootball.APIFootballMatch;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
*
@@ -20,8 +19,6 @@ public class TLWMatch extends BaseMatch{
private String groupId = null;
private String formulaHome = null;
private String formulaGuest = null;
private Integer koMatch = 0;
private Integer showTable = null;
private String trend = null;
private Float odd1 = null;
private Float oddX = null;
@@ -153,6 +150,14 @@ public class TLWMatch extends BaseMatch{
this.rating = referenceMatch.rating;
}
public TLWMatch(String formulaHome, String formulaGuest, String matchDateTime) {
this.teamIdHome = 0;
this.teamIdGuest = 0;
this.formulaHome = formulaHome;
this.formulaGuest = formulaGuest;
this.matchDatetime = matchDateTime;
}
public Integer getSeason() {
return this.season;
}
@@ -165,21 +170,13 @@ public class TLWMatch extends BaseMatch{
return this.matchNo;
}
public Integer getKoMatch() {
return this.koMatch;
}
public String getGroupId() {
return this.groupId;
}
public Integer getShowTable() {
return this.showTable;
}
public String getFormulaHome() {
String formula = "'D'";
if(this.teamIdHome != null) {
if(this.teamIdHome != null && this.teamIdHome != 0) {
return "''";
}
else if (this.formulaHome != null) {
@@ -190,7 +187,7 @@ public class TLWMatch extends BaseMatch{
public String getFormulaGuest() {
String formula = "'D'";
if(this.teamIdGuest != null) {
if(this.teamIdGuest != null && this.teamIdGuest != 0) {
return "''";
}
else if (this.formulaGuest != null) {
@@ -260,10 +257,6 @@ public class TLWMatch extends BaseMatch{
this.matchDatetime = matchDateTime;
}
public void setShowTable(Boolean showTable) {
this.showTable = showTable ? 0 : 1;
}
public void updateMatch(APIFootballMatch apiFootballMatch) {
this.teamIdHome = TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch, TeamIDMatcher.HOME);
this.teamIdGuest = TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch, TeamIDMatcher.GUEST);
@@ -281,4 +274,24 @@ public class TLWMatch extends BaseMatch{
return "";
}
}
public static boolean isSameMatchPlaceholder (TLWMatch tlwMatch, TLWMatch placeholderConfigMatch) {
String placeholderConfigMatchDateTime = placeholderConfigMatch.getMatchDateTime();
String tlwMatchDateTime = tlwMatch.getMatchDateTime();
String placeholderConfigMatchFormulaHome = placeholderConfigMatch.getFormulaHome();
String tlwMatchFormulaHome = tlwMatch.getFormulaHome();
String placeholderConfigMatchFormulaGuest = placeholderConfigMatch.getFormulaGuest();
String tlwMatchFormulaGuest = tlwMatch.getFormulaGuest();
if(Objects.equals(tlwMatchDateTime, placeholderConfigMatchDateTime) &&
Objects.equals(tlwMatchFormulaHome, placeholderConfigMatchFormulaHome) &&
Objects.equals(tlwMatchFormulaGuest, placeholderConfigMatchFormulaGuest)) {
return true;
}
if(Objects.equals(tlwMatchDateTime, placeholderConfigMatchDateTime) &&
Objects.equals(tlwMatch.getTeamIdHome(), null) &&
Objects.equals(tlwMatch.getTeamIdGuest(), null)) {
return true;
}
return false;
}
}