Various fixes for empty Relegation
This commit is contained in:
+1
-1
@@ -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 MatchesListGistUpdater --season ${season} --league 1 --configFile Tippliga >> log.txt 2>&1"
|
||||
} catch (Exception e) {
|
||||
telegramSendManual("TLW-Database-Tool crashed!")
|
||||
telegramSendManual("TLW-Database-Tool crashed in APIFootballUpdater!")
|
||||
}
|
||||
String outputString = readFile 'log.txt'
|
||||
if(outputString != "") {
|
||||
|
||||
+1
-1
@@ -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 TeamsUpdater --season ${season} --league 49 --configFile WM-Tippspiel >> log.txt 2>&1"
|
||||
} catch (Exception e) {
|
||||
telegramSendManual("TLW-Database-Tool crashed!")
|
||||
telegramSendManual("TLW-Database-Tool crashed in LigaCupUpdater!")
|
||||
}
|
||||
String outputString = readFile 'log.txt'
|
||||
if(outputString != "") {
|
||||
|
||||
+1
-1
@@ -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 TeamsUpdater --season ${season} --league 47 --configFile Relegation >> log.txt 2>&1"
|
||||
} catch (Exception e) {
|
||||
telegramSendManual("TLW-Database-Tool crashed!")
|
||||
telegramSendManual("TLW-Database-Tool crashed in RelegationUpdater!")
|
||||
}
|
||||
String outputString = readFile 'log.txt'
|
||||
if(outputString != "") {
|
||||
|
||||
+1
-1
@@ -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 TeamsUpdater --season ${season} --league 45 --configFile Supercup >> log.txt 2>&1"
|
||||
} catch (Exception e) {
|
||||
telegramSendManual("TLW-Database-Tool crashed!")
|
||||
telegramSendManual("TLW-Database-Tool crashed in SupercupUpdater!")
|
||||
}
|
||||
String outputString = readFile 'log.txt'
|
||||
if(outputString != "") {
|
||||
|
||||
+1
-1
@@ -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 TeamsUpdater --season ${season} --league 2 --configFile Tippliga >> log.txt 2>&1"
|
||||
} catch (Exception e) {
|
||||
telegramSendManual("TLW-Database-Tool crashed!")
|
||||
telegramSendManual("TLW-Database-Tool crashed in TippligaUpdater!")
|
||||
}
|
||||
String outputString = readFile 'log.txt'
|
||||
echo "Output: ${outputString}"
|
||||
|
||||
+1
-1
@@ -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 TeamsUpdater --season ${season} --league 48 --configFile WTL-Pokal >> log.txt 2>&1"
|
||||
} catch (Exception e) {
|
||||
telegramSendManual("TLW-Database-Tool crashed!")
|
||||
telegramSendManual("TLW-Database-Tool crashed in WTLPokalUpdater!")
|
||||
}
|
||||
String outputString = readFile 'log.txt'
|
||||
if(outputString != "") {
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ pipeline {
|
||||
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"
|
||||
} catch (Exception e) {
|
||||
telegramSendManual("TLW-Database-Tool crashed!")
|
||||
telegramSendManual("TLW-Database-Tool crashed in WhatsAppReminder!")
|
||||
}
|
||||
String outputString = readFile 'log.txt'
|
||||
if(outputString != "") {
|
||||
|
||||
@@ -117,6 +117,18 @@ public class TLWMatch extends BaseMatch{
|
||||
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) {
|
||||
this.season = season;
|
||||
this.matchday = matchday;
|
||||
|
||||
@@ -22,7 +22,7 @@ public class TLWMatchdaysCreator {
|
||||
this.season = season;
|
||||
this.league = league;
|
||||
|
||||
TLWMatchesCreatorFootball matchesCreator = new TLWMatchesCreatorFootball(season, 1, configPath);
|
||||
TLWMatchesCreatorFootball matchesCreator = new TLWMatchesCreatorFootball(season, league, configPath);
|
||||
this.matches = matchesCreator.getMatches();
|
||||
|
||||
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
|
||||
int matchesPerMatchdayTemp = 0;
|
||||
if(this.matchesPerMatchday != 0) {
|
||||
|
||||
@@ -44,6 +44,10 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase {
|
||||
|
||||
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> tlwMatchesUpdatedMatchday = new ArrayList<>();
|
||||
for (TLWMatch match : tlwMatchesOriginalMatchday) {
|
||||
@@ -58,9 +62,7 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase {
|
||||
LocalDateTime firstMatchOriginal = TLWMatchesManagerBase.getFirstMatchtimeTLW(tlwMatchesOriginalMatchday);
|
||||
LocalDateTime firstMatchUpdated = TLWMatchesManagerBase.getFirstMatchtimeAPIFootball(apiFootballMatches);
|
||||
|
||||
if(apiFootballMatches.size() > 0
|
||||
&& now.isBefore(firstMatchOriginal)
|
||||
&& now.isBefore(firstMatchUpdated)) {
|
||||
if(now.isBefore(firstMatchOriginal) && now.isBefore(firstMatchUpdated)) {
|
||||
addMissingMatches(tlwMatchesUpdatedMatchday, apiFootballMatches);
|
||||
updateMatchDateTimes(tlwMatchesUpdatedMatchday, apiFootballMatches);
|
||||
updateShowTable(tlwMatchesUpdatedMatchday, apiFootballMatches);
|
||||
|
||||
@@ -18,11 +18,39 @@
|
||||
"leagueMatchday": 35,
|
||||
"showTable": true
|
||||
},
|
||||
{
|
||||
"type": "PlaceholderSingleMatch",
|
||||
"koMatch": true,
|
||||
"placeholderDatetime": "2027-05-27 20:30:00",
|
||||
"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);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getMatchdaysRelegationSqlTest() {
|
||||
|
||||
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(season, 47, "Relegation");
|
||||
String sql = matchdaysCreator.getMatchdaysSQL();
|
||||
System.out.println(sql);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getMatchdaysEMTippspielSqlTest() {
|
||||
|
||||
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 49, "EM-Tippspiel");
|
||||
String sql = matchdaysCreator.getMatchdaysSQL();
|
||||
// System.out.println(sql);
|
||||
System.out.println(sql);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,4 +46,11 @@ public class TLWMatchesCreatorFootballTest {
|
||||
String sql = creator.getSQLInsertString();
|
||||
System.out.println(sql);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getMatchesRelegationSqlTest() {
|
||||
TLWMatchesCreatorFootball creator = new TLWMatchesCreatorFootball(season, 47, "Relegation");
|
||||
String sql = creator.getSQLInsertString();
|
||||
System.out.println(sql);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user