From 2ebfb79713e747e552d81833aba25cf2d458a65d Mon Sep 17 00:00:00 2001 From: Raz Date: Wed, 22 Jan 2025 11:06:28 +0100 Subject: [PATCH] =?UTF-8?q?forcer=20le=20score=20du=202eme=20=C3=A0=200=20?= =?UTF-8?q?si=20on=20valide=20sans=20finir=20de=20cliquer=20sur=20le=20num?= =?UTF-8?q?=20pad=20(edit=20score)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PadelClub/Data/Match.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/PadelClub/Data/Match.swift b/PadelClub/Data/Match.swift index 389543a..7b89728 100644 --- a/PadelClub/Data/Match.swift +++ b/PadelClub/Data/Match.swift @@ -603,6 +603,13 @@ defer { teamScoreOne.score = matchDescriptor.teamOneScores.joined(separator: ",") let teamScoreTwo = teamScore(.two) ?? TeamScore(match: id, team: team(.two)) teamScoreTwo.score = matchDescriptor.teamTwoScores.joined(separator: ",") + + if matchDescriptor.teamOneScores.last?.contains("-") == true && matchDescriptor.teamTwoScores.last?.contains("-") == false { + teamScoreTwo.score = (matchDescriptor.teamTwoScores.dropLast() + [matchDescriptor.teamTwoScores.last! + "-0"]).joined(separator: ",") + } else if matchDescriptor.teamTwoScores.last?.contains("-") == true && matchDescriptor.teamOneScores.last?.contains("-") == false { + teamScoreOne.score = (matchDescriptor.teamOneScores.dropLast() + [matchDescriptor.teamOneScores.last! + "-0"]).joined(separator: ",") + } + do { try self.tournamentStore.teamScores.addOrUpdate(contentOfs: [teamScoreOne, teamScoreTwo]) } catch {