diff --git a/.gitignore b/.gitignore index 6f15201..99874af 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ /target/ src/main/main.iml src/test/test.iml -bin \ No newline at end of file +bin +.env \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 94afeab..ec3f2ef 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -18,7 +18,7 @@ "request": "launch", "mainClass": "de.jeyp91.App", "envFile": "${workspaceFolder}/.env", - "args": " --mode MatchesCreatorFootball --season 2026 --league 47 --configFile Relegation" + "args": " --mode MatchesCreatorFootball --season 2026 --league 49 --configFile WM-Tippspiel" }, { "type": "java", @@ -26,7 +26,7 @@ "request": "launch", "mainClass": "de.jeyp91.App", "envFile": "${workspaceFolder}/.env", - "args": " --mode MatchesUpdaterFootball --season 2026 --league 48 --configFile WTL-Pokal" + "args": " --mode MatchesUpdaterFootball --season 2026 --league 49 --configFile WM-Tippspiel" }, { "type": "java", @@ -34,7 +34,7 @@ "request": "launch", "mainClass": "de.jeyp91.App", "envFile": "${workspaceFolder}/.env", - "args": " --mode MatchdaysUpdater --season 2026 --league 1 --configFile Tippliga" + "args": " --mode MatchdaysUpdater --season 2026 --league 49 --configFile WM-Tippspiel" }, { "type": "java", @@ -42,7 +42,7 @@ "request": "launch", "mainClass": "de.jeyp91.App", "envFile": "${workspaceFolder}/.env", - "args": " --mode MatchesResultsUpdater --season 2026 --league 1 --configFile Tippliga" + "args": " --mode MatchesResultsUpdater --season 2026 --league 49 --configFile WM-Tippspiel" }, { "type": "java", @@ -50,7 +50,15 @@ "request": "launch", "mainClass": "de.jeyp91.App", "envFile": "${workspaceFolder}/.env", - "args": " --mode MatchesListGistUpdater --season 2026 --league 1 --configFile Tippliga" + "args": " --mode MatchesListGistUpdater --season 2026 --league 49 --configFile WM-Tippspiel" + }, + { + "type": "java", + "name": "TeamsUpdater", + "request": "launch", + "mainClass": "de.jeyp91.App", + "envFile": "${workspaceFolder}/.env", + "args": " --mode TeamsUpdater --season 2026 --league 49 --configFile WM-Tippspiel" } ] } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..63000db --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,16 @@ +{ + "java.compile.nullAnalysis.mode": "automatic", + "java.configuration.updateBuildConfiguration": "interactive", + "java.test.config": { + "envFile": "${workspaceFolder}/.env", + "env": { + "AWS_ACCESS_KEY_ID": "AKIA4G4WGB26FLCFCU4M", + "AWS_SECRET_ACCESS_KEY": "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", + "FORUM_PASSWORD": "original", + "FORUM_USERNAME": "Julian", + "TLW_DATABASE_PASSWORD": "TippligaWuerzb_1", + "TLW_DATABASE_USERNAME": "d0144ddb" + } + }, + "java.debug.settings.onBuildFailureProceed": true, +} diff --git a/jenkinsfiles/APIFootballUpdater/Jenkinsfile b/jenkinsfiles/APIFootballUpdater/Jenkinsfile index 1530ca2..abd70e3 100644 --- a/jenkinsfiles/APIFootballUpdater/Jenkinsfile +++ b/jenkinsfiles/APIFootballUpdater/Jenkinsfile @@ -45,8 +45,8 @@ pipeline { build wait: false, job: 'TippligaUpdater' build wait: false, job: 'WTLPokalUpdater' build wait: false, job: 'SupercupUpdater' - // build wait: false, job: 'RelegationUpdater' - // build wait: false, job: 'LigaCupUpdater' + build wait: false, job: 'RelegationUpdater' + build wait: false, job: 'LigaCupUpdater' } } } diff --git a/jenkinsfiles/LigaCupUpdater/Jenkinsfile b/jenkinsfiles/LigaCupUpdater/Jenkinsfile index 96c9a4f..3aad140 100644 --- a/jenkinsfiles/LigaCupUpdater/Jenkinsfile +++ b/jenkinsfiles/LigaCupUpdater/Jenkinsfile @@ -20,10 +20,10 @@ pipeline { "JAVA_HOME=${jdkPath}/jdk-22.0.2" ]) { try { - sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchesUpdaterFootball --season ${season} --league 49 --configFile EM-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 EM-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 EM-Tippspiel >> log.txt 2>&1" - sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchesResultsUpdater --season ${season} --league 49 --configFile EM-Tippspiel >> log.txt 2>&1" + sh "$JAVA_HOME/bin/java -jar build/libs/tlw-database-tool-1.0.jar --mode MatchesUpdaterFootball --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 MatchesResultsUpdater --season ${season} --league 49 --configFile WM-Tippspiel >> log.txt 2>&1" } catch (Exception e) { telegramSendManual("TLW-Database-Tool crashed!") } diff --git a/jenkinsfiles/build/Jenkinsfile b/jenkinsfiles/build/Jenkinsfile index 5ae57db..ab9b5cd 100644 --- a/jenkinsfiles/build/Jenkinsfile +++ b/jenkinsfiles/build/Jenkinsfile @@ -36,8 +36,8 @@ pipeline { build wait: false, job: 'TippligaUpdater' build wait: false, job: 'WTLPokalUpdater' build wait: false, job: 'SupercupUpdater' - // build wait: false, job: 'RelegationUpdater' - // build wait: false, job: 'LigaCupUpdater' + build wait: false, job: 'RelegationUpdater' + build wait: false, job: 'LigaCupUpdater' } } } diff --git a/src/main/java/de/jeyp91/tippliga/TLWMatch.java b/src/main/java/de/jeyp91/tippliga/TLWMatch.java index 202d2c6..5813811 100644 --- a/src/main/java/de/jeyp91/tippliga/TLWMatch.java +++ b/src/main/java/de/jeyp91/tippliga/TLWMatch.java @@ -4,13 +4,13 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.Objects; -import de.jeyp91.App; -import de.jeyp91.BaseMatch; -import de.jeyp91.teamidmatcher.TeamIDMatcher; -import de.jeyp91.apifootball.APIFootballMatch; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import de.jeyp91.BaseMatch; +import de.jeyp91.apifootball.APIFootballMatch; +import de.jeyp91.teamidmatcher.TeamIDMatcher; + /** * */ @@ -179,19 +179,19 @@ public class TLWMatch extends BaseMatch{ } public String getFormulaHome() { - String formula = "'D'"; + String formula = "D"; if (this.formulaHome != null) { formula = this.formulaHome; } - return formula; + return "'" + formula + "'"; } public String getFormulaGuest() { - String formula = "'D'"; + String formula = "D"; if (this.formulaGuest != null) { formula = this.formulaGuest; } - return formula; + return "'" + formula + "'"; } public String getSQLQueryInsert() { @@ -210,8 +210,8 @@ public class TLWMatch extends BaseMatch{ return this.season + ", " + this.league + ", " + this.matchNo + ", " + - nullToSqlEmptyString(this.teamIdHome) + ", " + - nullToSqlEmptyString(this.teamIdGuest) + ", " + + nullToSqlNullString(this.teamIdHome) + ", " + + nullToSqlNullString(this.teamIdGuest) + ", " + nullToSqlEmptyString(this.goalsHome) + ", " + nullToSqlEmptyString(this.goalsGuest) + ", " + this.matchday + ", " + @@ -231,6 +231,10 @@ public class TLWMatch extends BaseMatch{ return number != null ? number.toString() : "''"; } + private String nullToSqlNullString(Integer number) { + return number != null ? number.toString() : "0"; + } + private String nullToSqlEmptyString(String string) { return string != null ? "'"+string+"'" : "''"; } diff --git a/src/main/java/de/jeyp91/tippliga/TLWMatchesUpdaterFootball.java b/src/main/java/de/jeyp91/tippliga/TLWMatchesUpdaterFootball.java index af0a0c6..5f96cc8 100644 --- a/src/main/java/de/jeyp91/tippliga/TLWMatchesUpdaterFootball.java +++ b/src/main/java/de/jeyp91/tippliga/TLWMatchesUpdaterFootball.java @@ -157,6 +157,9 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase { ArrayList apiFootballMatches) { ArrayList missingMatches = new ArrayList<>(); + if(!validateApiFootballTeamIds(apiFootballMatches)) { + return; + } for(APIFootballMatch apiFootballMatch : apiFootballMatches) { if(getMatchingMatch(apiFootballMatch, tlwMatches) == null) { @@ -316,4 +319,20 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase { public String getBeautifulInfo() { return this.beautifulInfo; } + + private boolean validateApiFootballTeamIds(ArrayList apiFootballMatches) { + + int missing = 0; + + for(APIFootballMatch apiFootballMatch : apiFootballMatches) { + if(TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch, TeamIDMatcher.HOME) == null) { + missing++; + } + if(TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch, TeamIDMatcher.GUEST) == null) { + missing++; + } + } + + return missing == 0; + } } diff --git a/src/main/resources/Tippliga/Team_ID_Matcher_Config.json b/src/main/resources/Tippliga/Team_ID_Matcher_Config.json index 52b83ac..f70eeb9 100644 --- a/src/main/resources/Tippliga/Team_ID_Matcher_Config.json +++ b/src/main/resources/Tippliga/Team_ID_Matcher_Config.json @@ -1358,5 +1358,175 @@ "teamname": "AEK Athens", "tippligaID": 404, "apiFootballID": 575 + }, + { + "teamname": "Mexico", + "tippligaID": 916, + "apiFootballID": 16 + }, + { + "teamname": "South Africa", + "tippligaID": 928, + "apiFootballID": 1531 + }, + { + "teamname": "South Korea", + "tippligaID": 929, + "apiFootballID": 17 + }, + { + "teamname": "Canada", + "tippligaID": 664, + "apiFootballID": 5529 + }, + { + "teamname": "Bosnia & Herzegovina", + "tippligaID": 724, + "apiFootballID": 1113 + }, + { + "teamname": "USA", + "tippligaID": 931, + "apiFootballID": 2384 + }, + { + "teamname": "Paraguay", + "tippligaID": 921, + "apiFootballID": 2380 + }, + { + "teamname": "Qatar", + "tippligaID": 665, + "apiFootballID": 1569 + }, + { + "teamname": "Brazil", + "tippligaID": 903, + "apiFootballID": 6 + }, + { + "teamname": "Morocco", + "tippligaID": 707, + "apiFootballID": 31 + }, + { + "teamname": "Haiti", + "tippligaID": 666, + "apiFootballID": 2386 + }, + { + "teamname": "Australia", + "tippligaID": 902, + "apiFootballID": 20 + }, + { + "teamname": "New Zealand", + "tippligaID": 917, + "apiFootballID": 4673 + }, + { + "teamname": "Ghana", + "tippligaID": 910, + "apiFootballID": 1504 + }, + { + "teamname": "Panama", + "tippligaID": 705, + "apiFootballID": 11 + }, + { + "teamname": "Colombia", + "tippligaID": 938, + "apiFootballID": 8 + }, + { + "teamname": "Congo DR", + "tippligaID": 667, + "apiFootballID": 1508 + }, + { + "teamname": "Uzbekistan", + "tippligaID": 668, + "apiFootballID": 1568 + }, + { + "teamname": "Algeria", + "tippligaID": 900, + "apiFootballID": 1532 + }, + { + "teamname": "Jordan", + "tippligaID": 669, + "apiFootballID": 1548 + }, + { + "teamname": "Argentina", + "tippligaID": 901, + "apiFootballID": 26 + }, + { + "teamname": "Senegal", + "tippligaID": 708, + "apiFootballID": 13 + }, + { + "teamname": "Iraq", + "tippligaID": 670, + "apiFootballID": 1567 + }, + { + "teamname": "Norway", + "tippligaID": 823, + "apiFootballID": 1090 + }, + { + "teamname": "Uruguay", + "tippligaID": 930, + "apiFootballID": 7 + }, + { + "teamname": "Cape Verde Islands", + "tippligaID": 671, + "apiFootballID": 1533 + }, + { + "teamname": "Saudi Arabia", + "tippligaID": 703, + "apiFootballID": 23 + }, + { + "teamname": "Egypt", + "tippligaID": 706, + "apiFootballID": 32 + }, + { + "teamname": "Iran", + "tippligaID": 937, + "apiFootballID": 22 + }, + { + "teamname": "Ecuador", + "tippligaID": 934, + "apiFootballID": 2382 + }, + { + "teamname": "CuraƧao", + "tippligaID": 672, + "apiFootballID": 5530 + }, + { + "teamname": "Ivory Coast", + "tippligaID": 907, + "apiFootballID": 1501 + }, + { + "teamname": "Japan", + "tippligaID": 914, + "apiFootballID": 12 + }, + { + "teamname": "Tunisia", + "tippligaID": 710, + "apiFootballID": 28 } ] \ No newline at end of file diff --git a/src/main/resources/Tippliga_Configs/lc_2026.json b/src/main/resources/Tippliga_Configs/lc_2026.json index 8edfc1c..8309e7d 100644 --- a/src/main/resources/Tippliga_Configs/lc_2026.json +++ b/src/main/resources/Tippliga_Configs/lc_2026.json @@ -1,295 +1,133 @@ { - "numberOfMatchdays": 7, + "numberOfMatchdays": 8, "matchesPerMatchday": 0, "pointMode": 4, "pointsTendency": 1, "pointsDifference": 2, "pointsDirectHit": 3, - "ko": 0, + "ko": 1, "matchdayConfig": [ { "TLWMatchday": 1, - "numberOfMatches": 12, + "numberOfMatches": 24, "matchdayName": "1. Spieltag", "matchesConfig": [ { "type": "AllMatchesOfMatchday", - "matchesLeague": 5858, + "matchesLeague": 1, "leagueMatchday": 1, "showTable": true - }, - { - "type": "AllMatchesOfMatchday", - "matchesLeague": 5858, - "leagueMatchday": 2, - "showTable": true - }, - { - "type": "AllMatchesOfMatchday", - "matchesLeague": 5858, - "leagueMatchday": 3, - "showTable": true - }, - { - "type": "AllMatchesOfMatchday", - "matchesLeague": 5858, - "leagueMatchday": 4, - "showTable": true - }, - { - "type": "AllMatchesOfMatchday", - "matchesLeague": 5858, - "leagueMatchday": 5, - "showTable": true - }, - { - "type": "AllMatchesOfMatchday", - "matchesLeague": 5858, - "leagueMatchday": 6, - "showTable": true } ] }, { "TLWMatchday": 2, - "numberOfMatches": 12, + "numberOfMatches": 24, "matchdayName": "2. Spieltag", "matchesConfig": [ { "type": "AllMatchesOfMatchday", - "matchesLeague": 5858, - "leagueMatchday": 7, - "showTable": true - }, - { - "type": "AllMatchesOfMatchday", - "matchesLeague": 5858, - "leagueMatchday": 8, - "showTable": true - }, - { - "type": "AllMatchesOfMatchday", - "matchesLeague": 5858, - "leagueMatchday": 9, - "showTable": true - }, - { - "type": "AllMatchesOfMatchday", - "matchesLeague": 5858, - "leagueMatchday": 10, - "showTable": true - }, - { - "type": "AllMatchesOfMatchday", - "matchesLeague": 5858, - "leagueMatchday": 11, - "showTable": true - }, - { - "type": "AllMatchesOfMatchday", - "matchesLeague": 5858, - "leagueMatchday": 12, + "matchesLeague": 1, + "leagueMatchday": 2, "showTable": true } ] }, { "TLWMatchday": 3, - "numberOfMatches": 12, + "numberOfMatches": 24, "matchdayName": "3. Spieltag", "matchesConfig": [ { "type": "AllMatchesOfMatchday", - "matchesLeague": 5858, - "leagueMatchday": 13, - "showTable": true - }, - { - "type": "AllMatchesOfMatchday", - "matchesLeague": 5858, - "leagueMatchday": 14, - "showTable": true - }, - { - "type": "AllMatchesOfMatchday", - "matchesLeague": 5858, - "leagueMatchday": 15, - "showTable": true - }, - { - "type": "AllMatchesOfMatchday", - "matchesLeague": 5858, - "leagueMatchday": 16, - "showTable": true - }, - { - "type": "AllMatchesOfMatchday", - "matchesLeague": 5858, - "leagueMatchday": 17, - "showTable": true - }, - { - "type": "AllMatchesOfMatchday", - "matchesLeague": 5858, - "leagueMatchday": 18, + "matchesLeague": 1, + "leagueMatchday": 3, "showTable": true } ] }, { "TLWMatchday": 4, - "numberOfMatches": 8, - "matchdayName": "Achtelfinale", + "numberOfMatches": 16, + "matchdayName": "Sechzentelfinale", "matchesConfig": [ { "type": "AllMatchesOfMatchday", - "matchesLeague": 5858, - "leagueMatchday": 19, + "matchesLeague": 1, + "leagueMatchday": 4, "showTable": true }, { - "type": "PlaceholderSingleMatch", - "koMatch": true, - "placeholderDatetime": "2024-06-29 18:00:00", - "formulaHome": "G A2", - "formulaGuest": "G B2" - }, - { - "type": "PlaceholderSingleMatch", - "koMatch": true, - "placeholderDatetime": "2024-06-29 21:00:00", - "formulaHome": "G A1", - "formulaGuest": "G C2" - }, - { - "type": "PlaceholderSingleMatch", - "koMatch": true, - "placeholderDatetime": "2024-06-30 18:00:00", - "formulaHome": "G C1", - "formulaGuest": "D" - }, - { - "type": "PlaceholderSingleMatch", - "koMatch": true, - "placeholderDatetime": "2024-06-30 21:00:00", - "formulaHome": "G B1", - "formulaGuest": "D" - }, - { - "type": "PlaceholderSingleMatch", - "koMatch": true, - "placeholderDatetime": "2024-07-01 18:00:00", - "formulaHome": "G D2", - "formulaGuest": "G E2" - }, - { - "type": "PlaceholderSingleMatch", - "koMatch": true, - "placeholderDatetime": "2024-07-01 21:00:00", - "formulaHome": "G F1", - "formulaGuest": "D" - }, - { - "type": "PlaceholderSingleMatch", - "koMatch": true, - "placeholderDatetime": "2024-07-02 18:00:00", - "formulaHome": "G E1", - "formulaGuest": "D" - }, - { - "type": "PlaceholderSingleMatch", - "koMatch": true, - "placeholderDatetime": "2024-07-02 21:00:00", - "formulaHome": "G D1", - "formulaGuest": "G F2" + "type": "Placeholder", + "placeholderDatetime": "2026-06-28 21:00:00" } ] }, { "TLWMatchday": 5, - "numberOfMatches": 4, - "matchdayName": "Viertelfinale", + "numberOfMatches": 8, + "matchdayName": "Achtelfinale", "matchesConfig": [ { "type": "AllMatchesOfMatchday", - "matchesLeague": 5858, - "leagueMatchday": 20, + "matchesLeague": 1, + "leagueMatchday": 5, "showTable": true }, { - "type": "PlaceholderSingleMatch", - "koMatch": true, - "placeholderDatetime": "2024-07-05 18:00:00", - "formulaHome": "W 40", - "formulaGuest": "W 38" - }, - { - "type": "PlaceholderSingleMatch", - "koMatch": true, - "placeholderDatetime": "2024-07-05 21:00:00", - "formulaHome": "W 42", - "formulaGuest": "W 41" - }, - { - "type": "PlaceholderSingleMatch", - "koMatch": true, - "placeholderDatetime": "2024-07-06 18:00:00", - "formulaHome": "W 39", - "formulaGuest": "W 37" - }, - { - "type": "PlaceholderSingleMatch", - "koMatch": true, - "placeholderDatetime": "2024-07-06 21:00:00", - "formulaHome": "W 43", - "formulaGuest": "W 44" + "type": "Placeholder", + "placeholderDatetime": "2026-07-04 19:00:00" } ] }, { "TLWMatchday": 6, - "numberOfMatches": 2, - "matchdayName": "Halbfinale", + "numberOfMatches": 4, + "matchdayName": "Viertelfinale", "matchesConfig": [ { "type": "AllMatchesOfMatchday", - "matchesLeague": 5858, - "leagueMatchday": 21, + "matchesLeague": 1, + "leagueMatchday": 6, "showTable": true }, { - "type": "PlaceholderSingleMatch", - "koMatch": true, - "placeholderDatetime": "2024-07-09 21:00:00", - "formulaHome": "W 45", - "formulaGuest": "W 46" - }, - { - "type": "PlaceholderSingleMatch", - "koMatch": true, - "placeholderDatetime": "2024-07-10 21:00:00", - "formulaHome": "W 48", - "formulaGuest": "W 47" + "type": "Placeholder", + "placeholderDatetime": "2026-07-09 22:00:00" } ] }, { "TLWMatchday": 7, - "numberOfMatches": 1, + "numberOfMatches": 2, + "matchdayName": "Halbfinale", + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 1, + "leagueMatchday": 7, + "showTable": true + }, + { + "type": "Placeholder", + "placeholderDatetime": "2026-07-14 21:00:00" + } + ] + }, + { + "TLWMatchday": 8, + "numberOfMatches": 2, "matchdayName": "Finale", "matchesConfig": [ { "type": "AllMatchesOfMatchday", - "matchesLeague": 5858, - "leagueMatchday": 22, + "matchesLeague": 1, + "leagueMatchday": 8, "showTable": true }, { - "type": "PlaceholderSingleMatch", - "koMatch": true, - "placeholderDatetime": "2024-07-14 21:00:00", - "formulaHome": "W 49", - "formulaGuest": "W 50" + "type": "Placeholder", + "placeholderDatetime": "2026-07-18 23:00:00" } ] }