Improve logic for adding missing matches with placeholder and formula

This commit is contained in:
2026-06-28 11:32:31 +02:00
parent 062160e09e
commit c07a155ecb
7 changed files with 21 additions and 11 deletions
@@ -168,13 +168,23 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase {
}
for (APIFootballMatch missingMatch : missingMatches) {
Integer missingTeamIdHome = TeamIDMatcher.getTippligaIdFromApiFootballId(missingMatch, TeamIDMatcher.HOME);
Integer missingTeamIdGuest = TeamIDMatcher.getTippligaIdFromApiFootballId(missingMatch, TeamIDMatcher.GUEST);
boolean done = false;
// update placeholder match based on matching match datetime
for (TLWMatch tlwMatch : tlwMatches) {
if ( tlwMatch.getTeamIdHome() == 0 && tlwMatch.getTeamIdGuest() == 0
&& Objects.equals(tlwMatch.getMatchDateTime(), missingMatch.getMatchDateTime().replace("T", " ").substring(0, 19))
&& !Objects.equals(tlwMatch.getFormulaHome(), "")
&& !Objects.equals(tlwMatch.getFormulaGuest(), "")) {
Boolean homeMatches = tlwMatch.getTeamIdHome() == 0 || tlwMatch.getTeamIdHome().equals(missingTeamIdHome);
Boolean guestMatches =tlwMatch.getTeamIdGuest() == 0 || tlwMatch.getTeamIdGuest().equals(missingTeamIdGuest);
Boolean timeMatches = Objects.equals(tlwMatch.getMatchDateTime(), missingMatch.getMatchDateTime().replace("T", " ").substring(0, 19));
Boolean formulaHomeMatches = !Objects.equals(tlwMatch.getFormulaHome(), "");
Boolean formulaGuestMatches = !Objects.equals(tlwMatch.getFormulaGuest(), "");
if (
homeMatches
&& guestMatches
&& timeMatches
&& formulaHomeMatches
&& formulaGuestMatches
) {
tlwMatch.updateMatch(missingMatch);
done = true;
break;