Various fixes for empty Relegation

This commit is contained in:
2026-08-04 21:44:11 +02:00
parent c8ec6f1846
commit 27f6b663ab
14 changed files with 92 additions and 21 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ pipeline {
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode APIFootballUpdater --season ${season} --league 1 --configFile Tippliga >> log.txt 2>&1" sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode APIFootballUpdater --season ${season} --league 1 --configFile Tippliga >> log.txt 2>&1"
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchesListGistUpdater --season ${season} --league 1 --configFile Tippliga >> log.txt 2>&1" sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchesListGistUpdater --season ${season} --league 1 --configFile Tippliga >> log.txt 2>&1"
} catch (Exception e) { } catch (Exception e) {
telegramSendManual("TLW-Database-Tool crashed!") telegramSendManual("TLW-Database-Tool crashed in APIFootballUpdater!")
} }
String outputString = readFile 'log.txt' String outputString = readFile 'log.txt'
if(outputString != "") { if(outputString != "") {
+1 -1
View File
@@ -27,7 +27,7 @@ pipeline {
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchdaysUpdater --season ${season} --league 49 --configFile WM-Tippspiel >> log.txt 2>&1" sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchdaysUpdater --season ${season} --league 49 --configFile WM-Tippspiel >> log.txt 2>&1"
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode TeamsUpdater --season ${season} --league 49 --configFile WM-Tippspiel >> log.txt 2>&1" sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode TeamsUpdater --season ${season} --league 49 --configFile WM-Tippspiel >> log.txt 2>&1"
} catch (Exception e) { } catch (Exception e) {
telegramSendManual("TLW-Database-Tool crashed!") telegramSendManual("TLW-Database-Tool crashed in LigaCupUpdater!")
} }
String outputString = readFile 'log.txt' String outputString = readFile 'log.txt'
if(outputString != "") { if(outputString != "") {
+1 -1
View File
@@ -27,7 +27,7 @@ pipeline {
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchdaysUpdater --season ${season} --league 47 --configFile Relegation >> log.txt 2>&1" sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchdaysUpdater --season ${season} --league 47 --configFile Relegation >> log.txt 2>&1"
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode TeamsUpdater --season ${season} --league 47 --configFile Relegation >> log.txt 2>&1" sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode TeamsUpdater --season ${season} --league 47 --configFile Relegation >> log.txt 2>&1"
} catch (Exception e) { } catch (Exception e) {
telegramSendManual("TLW-Database-Tool crashed!") telegramSendManual("TLW-Database-Tool crashed in RelegationUpdater!")
} }
String outputString = readFile 'log.txt' String outputString = readFile 'log.txt'
if(outputString != "") { if(outputString != "") {
+1 -1
View File
@@ -27,7 +27,7 @@ pipeline {
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchdaysUpdater --season ${season} --league 45 --configFile Supercup >> log.txt 2>&1" sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchdaysUpdater --season ${season} --league 45 --configFile Supercup >> log.txt 2>&1"
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode TeamsUpdater --season ${season} --league 45 --configFile Supercup >> log.txt 2>&1" sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode TeamsUpdater --season ${season} --league 45 --configFile Supercup >> log.txt 2>&1"
} catch (Exception e) { } catch (Exception e) {
telegramSendManual("TLW-Database-Tool crashed!") telegramSendManual("TLW-Database-Tool crashed in SupercupUpdater!")
} }
String outputString = readFile 'log.txt' String outputString = readFile 'log.txt'
if(outputString != "") { if(outputString != "") {
+1 -1
View File
@@ -31,7 +31,7 @@ pipeline {
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchdaysUpdater --season ${season} --league 2 --configFile Tippliga >> log.txt 2>&1" sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchdaysUpdater --season ${season} --league 2 --configFile Tippliga >> log.txt 2>&1"
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode TeamsUpdater --season ${season} --league 2 --configFile Tippliga >> log.txt 2>&1" sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode TeamsUpdater --season ${season} --league 2 --configFile Tippliga >> log.txt 2>&1"
} catch (Exception e) { } catch (Exception e) {
telegramSendManual("TLW-Database-Tool crashed!") telegramSendManual("TLW-Database-Tool crashed in TippligaUpdater!")
} }
String outputString = readFile 'log.txt' String outputString = readFile 'log.txt'
echo "Output: ${outputString}" echo "Output: ${outputString}"
+1 -1
View File
@@ -27,7 +27,7 @@ pipeline {
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchdaysUpdater --season ${season} --league 48 --configFile WTL-Pokal >> log.txt 2>&1" sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchdaysUpdater --season ${season} --league 48 --configFile WTL-Pokal >> log.txt 2>&1"
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode TeamsUpdater --season ${season} --league 48 --configFile WTL-Pokal >> log.txt 2>&1" sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode TeamsUpdater --season ${season} --league 48 --configFile WTL-Pokal >> log.txt 2>&1"
} catch (Exception e) { } catch (Exception e) {
telegramSendManual("TLW-Database-Tool crashed!") telegramSendManual("TLW-Database-Tool crashed in WTLPokalUpdater!")
} }
String outputString = readFile 'log.txt' String outputString = readFile 'log.txt'
if(outputString != "") { if(outputString != "") {
+1 -1
View File
@@ -25,7 +25,7 @@ pipeline {
try { try {
sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode WhatsAppNotifier --season ${season} --league 1 --configFile Tippliga >> log.txt 2>&1" sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode WhatsAppNotifier --season ${season} --league 1 --configFile Tippliga >> log.txt 2>&1"
} catch (Exception e) { } catch (Exception e) {
telegramSendManual("TLW-Database-Tool crashed!") telegramSendManual("TLW-Database-Tool crashed in WhatsAppReminder!")
} }
String outputString = readFile 'log.txt' String outputString = readFile 'log.txt'
if(outputString != "") { if(outputString != "") {
@@ -117,6 +117,18 @@ public class TLWMatch extends BaseMatch{
this.matchDatetime = matchDatetime; this.matchDatetime = matchDatetime;
} }
public TLWMatch(int season, int league, int matchday, int matchNo, int status, int koMatch, String formulaHome, String formulaGuest, String matchDatetime) {
this.season = season;
this.matchday = matchday;
this.league = league;
this.matchNo = matchNo;
this.status = status;
this.koMatch = koMatch;
this.formulaHome = formulaHome;
this.formulaGuest = formulaGuest;
this.matchDatetime = matchDatetime;
}
public TLWMatch(int season, int league, int matchday, int matchNo, int teamIdHome, int teamIdGuest, String matchDatetime, int koMatch) { public TLWMatch(int season, int league, int matchday, int matchNo, int teamIdHome, int teamIdGuest, String matchDatetime, int koMatch) {
this.season = season; this.season = season;
this.matchday = matchday; this.matchday = matchday;
@@ -22,7 +22,7 @@ public class TLWMatchdaysCreator {
this.season = season; this.season = season;
this.league = league; this.league = league;
TLWMatchesCreatorFootball matchesCreator = new TLWMatchesCreatorFootball(season, 1, configPath); TLWMatchesCreatorFootball matchesCreator = new TLWMatchesCreatorFootball(season, league, configPath);
this.matches = matchesCreator.getMatches(); this.matches = matchesCreator.getMatches();
TippligaConfigProvider prov = new TippligaConfigProvider(season); TippligaConfigProvider prov = new TippligaConfigProvider(season);
@@ -69,6 +69,20 @@ public class TLWMatchesCreatorFootball extends TLWMatchesCreatorBase {
} }
} }
// Add PlaceholderSingleMatch matches
for (Object matchesConfigObject : matchesConfig) {
JSONObject singleMatchConfig = (JSONObject) matchesConfigObject;
if(singleMatchConfig.get("type").equals("PlaceholderSingleMatch")) {
String formulaHome = (String) singleMatchConfig.get("formulaHome");
String formulaGuest = (String) singleMatchConfig.get("formulaGuest");
String matchDatetime = (String) singleMatchConfig.get("placeholderDatetime");
int matchNo = this.nextMatchNo;
this.nextMatchNo++;
this.TLWMatches.add(new TLWMatch(this.season, this.league, TLWMatchday, matchNo, 0, this.ko, formulaHome, formulaGuest, matchDatetime));
matchdayMatchCounter++;
}
}
// Add empty missing matches // Add empty missing matches
int matchesPerMatchdayTemp = 0; int matchesPerMatchdayTemp = 0;
if(this.matchesPerMatchday != 0) { if(this.matchesPerMatchday != 0) {
@@ -44,6 +44,10 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase {
ArrayList<APIFootballMatch> apiFootballMatches = apiFootballMatchesProvider.getAPIFootballMatchesFromConfig((JSONObject) singleMatchdayConfig); ArrayList<APIFootballMatch> apiFootballMatches = apiFootballMatchesProvider.getAPIFootballMatchesFromConfig((JSONObject) singleMatchdayConfig);
if(apiFootballMatches.isEmpty()) {
continue;
}
ArrayList<TLWMatch> tlwMatchesOriginalMatchday = tippligaSQLConnector.getMatches(String.valueOf(this.season), String.valueOf(this.league), String.valueOf(tlwMatchday)); ArrayList<TLWMatch> tlwMatchesOriginalMatchday = tippligaSQLConnector.getMatches(String.valueOf(this.season), String.valueOf(this.league), String.valueOf(tlwMatchday));
ArrayList<TLWMatch> tlwMatchesUpdatedMatchday = new ArrayList<>(); ArrayList<TLWMatch> tlwMatchesUpdatedMatchday = new ArrayList<>();
for (TLWMatch match : tlwMatchesOriginalMatchday) { for (TLWMatch match : tlwMatchesOriginalMatchday) {
@@ -58,9 +62,7 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase {
LocalDateTime firstMatchOriginal = TLWMatchesManagerBase.getFirstMatchtimeTLW(tlwMatchesOriginalMatchday); LocalDateTime firstMatchOriginal = TLWMatchesManagerBase.getFirstMatchtimeTLW(tlwMatchesOriginalMatchday);
LocalDateTime firstMatchUpdated = TLWMatchesManagerBase.getFirstMatchtimeAPIFootball(apiFootballMatches); LocalDateTime firstMatchUpdated = TLWMatchesManagerBase.getFirstMatchtimeAPIFootball(apiFootballMatches);
if(apiFootballMatches.size() > 0 if(now.isBefore(firstMatchOriginal) && now.isBefore(firstMatchUpdated)) {
&& now.isBefore(firstMatchOriginal)
&& now.isBefore(firstMatchUpdated)) {
addMissingMatches(tlwMatchesUpdatedMatchday, apiFootballMatches); addMissingMatches(tlwMatchesUpdatedMatchday, apiFootballMatches);
updateMatchDateTimes(tlwMatchesUpdatedMatchday, apiFootballMatches); updateMatchDateTimes(tlwMatchesUpdatedMatchday, apiFootballMatches);
updateShowTable(tlwMatchesUpdatedMatchday, apiFootballMatches); updateShowTable(tlwMatchesUpdatedMatchday, apiFootballMatches);
@@ -13,16 +13,44 @@
"numberOfMatches": 4, "numberOfMatches": 4,
"matchesConfig": [ "matchesConfig": [
{ {
"type": "AllMatchesOfMatchday", "type": "AllMatchesOfMatchday",
"matchesLeague": 78, "matchesLeague": 78,
"leagueMatchday": 35, "leagueMatchday": 35,
"showTable": true "showTable": true
}, },
{ {
"type": "AllMatchesOfMatchday", "type": "PlaceholderSingleMatch",
"matchesLeague": 79, "koMatch": true,
"leagueMatchday": 35, "placeholderDatetime": "2027-05-27 20:30:00",
"showTable": true "formulaHome": "D",
"formulaGuest": "D"
},
{
"type": "PlaceholderSingleMatch",
"koMatch": true,
"placeholderDatetime": "2027-05-31 20:30:00",
"formulaHome": "D",
"formulaGuest": "D"
},
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 79,
"leagueMatchday": 35,
"showTable": true
},
{
"type": "PlaceholderSingleMatch",
"koMatch": true,
"placeholderDatetime": "2027-05-28 20:30:00",
"formulaHome": "D",
"formulaGuest": "D"
},
{
"type": "PlaceholderSingleMatch",
"koMatch": true,
"placeholderDatetime": "2027-06-01 20:30:00",
"formulaHome": "D",
"formulaGuest": "D"
} }
] ]
} }
@@ -90,11 +90,19 @@ public class TLWMatchdaysCreatorTest {
System.out.println(sql); System.out.println(sql);
} }
@Test
public void getMatchdaysRelegationSqlTest() {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(season, 47, "Relegation");
String sql = matchdaysCreator.getMatchdaysSQL();
System.out.println(sql);
}
@Test @Test
public void getMatchdaysEMTippspielSqlTest() { public void getMatchdaysEMTippspielSqlTest() {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 49, "EM-Tippspiel"); TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 49, "EM-Tippspiel");
String sql = matchdaysCreator.getMatchdaysSQL(); String sql = matchdaysCreator.getMatchdaysSQL();
// System.out.println(sql); System.out.println(sql);
} }
} }
@@ -46,4 +46,11 @@ public class TLWMatchesCreatorFootballTest {
String sql = creator.getSQLInsertString(); String sql = creator.getSQLInsertString();
System.out.println(sql); System.out.println(sql);
} }
@Test
public void getMatchesRelegationSqlTest() {
TLWMatchesCreatorFootball creator = new TLWMatchesCreatorFootball(season, 47, "Relegation");
String sql = creator.getSQLInsertString();
System.out.println(sql);
}
} }