Fix updating of showTable value
This commit is contained in:
@@ -89,7 +89,7 @@ public abstract class BaseMatch {
|
||||
}
|
||||
|
||||
public Integer getShowTable() {
|
||||
return this.koMatch;
|
||||
return this.showTable;
|
||||
}
|
||||
|
||||
public void setShowTable(boolean showTable) {
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
package de.jeyp91.tippliga;
|
||||
|
||||
import de.jeyp91.StatusHolder;
|
||||
import de.jeyp91.teamidmatcher.TeamIDMatcher;
|
||||
import de.jeyp91.apifootball.APIFootballMatch;
|
||||
import de.jeyp91.apifootball.APIFootballMatchesProvider;
|
||||
import de.jeyp91.tippligaforum.TippligaSQLConnector;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import java.time.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import de.jeyp91.StatusHolder;
|
||||
import de.jeyp91.apifootball.APIFootballMatch;
|
||||
import de.jeyp91.apifootball.APIFootballMatchesProvider;
|
||||
import de.jeyp91.teamidmatcher.TeamIDMatcher;
|
||||
import de.jeyp91.tippligaforum.TippligaSQLConnector;
|
||||
|
||||
public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase {
|
||||
private static final Logger logger = LoggerFactory.getLogger(TLWMatchesUpdaterFootball.class);
|
||||
|
||||
@@ -281,6 +282,9 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase {
|
||||
for(APIFootballMatch apiFootballMatch : apiFootballMatches) {
|
||||
try {
|
||||
TLWMatch tlwMatch = getMatchingMatch(apiFootballMatch, tlwMatchesCopy);
|
||||
if(tlwMatch.getTeamIdHome() == 4) {
|
||||
int debug = 1;
|
||||
}
|
||||
tlwMatchesCopy.remove(tlwMatch);
|
||||
tlwMatch.setShowTable(apiFootballMatch.getShowTable() == 0);
|
||||
} catch (NullPointerException ignored) {
|
||||
|
||||
@@ -1,24 +1,26 @@
|
||||
package de.jeyp91.tippligaforum;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import de.jeyp91.StatusHolder;
|
||||
import de.jeyp91.tippliga.TLWLeague;
|
||||
import de.jeyp91.tippliga.TLWMatch;
|
||||
import de.jeyp91.tippliga.TLWMatchday;
|
||||
import de.jeyp91.tippliga.TLWTeam;
|
||||
import de.jeyp91.whatsapp.WhatsAppReminder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
public class TippligaSQLConnector {
|
||||
|
||||
@@ -323,6 +325,35 @@ public class TippligaSQLConnector {
|
||||
return post;
|
||||
}
|
||||
|
||||
public String getNextMailReminder(int hours) {
|
||||
String query = """
|
||||
WITH next_delivery_date AS (
|
||||
SELECT
|
||||
m.season,
|
||||
m.league,
|
||||
l.league_name,
|
||||
l.bet_type,
|
||||
m.matchday,
|
||||
m.matchday_name,
|
||||
delivery_date,
|
||||
STR_TO_DATE(delivery_date, '%Y-%m-%d %H:%i:%s') as parsed_delivery_date
|
||||
FROM phpbb_footb_matchdays m
|
||||
LEFT JOIN phpbb_footb_leagues l ON (m.season = l.season AND m.league = l.league)
|
||||
HAVING parsed_delivery_date > NOW() AND parsed_delivery_date < NOW() + INTERVAL {{remainingHours}} HOUR
|
||||
)
|
||||
""".replace("{{remainingHours}}", "" + hours);
|
||||
ResultSet rset = executeQuery(query);
|
||||
String reminder = null;
|
||||
try {
|
||||
if (rset.next()) {
|
||||
reminder = "Reminder for user: " + rset.getString("username") + " for matchday: " + rset.getString("matchday");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return reminder;
|
||||
}
|
||||
|
||||
public ArrayList<WhatsAppReminder> getNextWhatsAppReminders(int hours) {
|
||||
final String remindersToSendQuery = """
|
||||
WITH delivery_date_next_day AS (
|
||||
|
||||
@@ -53,7 +53,7 @@ public class TLWTeamsCreatorTest {
|
||||
TLWMatchesCreatorFootball matchesCreator = new TLWMatchesCreatorFootball(2021, 49, "EM-Tippspiel");
|
||||
ArrayList<TLWMatch> matches = matchesCreator.getMatches();
|
||||
|
||||
TLWTeamsCreator teamCreator = new TLWTeamsCreator(2021, 49, matches);
|
||||
TLWTeamsCreator teamCreator = new TLWTeamsCreator(season, 49, matches);
|
||||
String sql = teamCreator.getSql();
|
||||
System.out.println(sql);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user