|
|
|
|
@ -44,6 +44,7 @@ final class PlayerRegistration: ModelObject, Storable { |
|
|
|
|
var clubCode: String? |
|
|
|
|
var sourceName: String? |
|
|
|
|
var isNveq: Bool = false |
|
|
|
|
var isEQConfirmed: Bool? |
|
|
|
|
|
|
|
|
|
func localizedSourceLabel() -> String { |
|
|
|
|
switch source { |
|
|
|
|
@ -196,9 +197,16 @@ final class PlayerRegistration: ModelObject, Storable { |
|
|
|
|
|
|
|
|
|
var duplicatePlayers: Int? |
|
|
|
|
|
|
|
|
|
func championshipAlerts(tournament: Tournament, allPlayers: [(String, String)]) -> [ChampionshipAlert] { |
|
|
|
|
func championshipAlerts(tournament: Tournament, allPlayers: [(String, String)], forRegional: Bool) -> [ChampionshipAlert] { |
|
|
|
|
var alerts = [ChampionshipAlert]() |
|
|
|
|
|
|
|
|
|
if forRegional { |
|
|
|
|
if isNveq == false && (isEQConfirmed == false || isEQConfirmed == nil) { |
|
|
|
|
alerts.append(.notEQ(isEQConfirmed, self)) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if duplicatePlayers == nil { |
|
|
|
|
let teamClubCode = self.team()?.clubCode |
|
|
|
|
let strippedLicense = self.licenceId?.strippedLicense |
|
|
|
|
@ -347,7 +355,25 @@ final class PlayerRegistration: ModelObject, Storable { |
|
|
|
|
return "non classé" + (isMalePlayer() ? "" : "e") |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func verifyEQ(from sources: [CSVParser]) async throws { |
|
|
|
|
#if DEBUG_TIME //DEBUGING TIME |
|
|
|
|
let start = Date() |
|
|
|
|
defer { |
|
|
|
|
let duration = Duration.milliseconds(Date().timeIntervalSince(start) * 1_000) |
|
|
|
|
print("func updateRank()", id, duration.formatted(.units(allowed: [.seconds, .milliseconds]))) |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
if let dataFound = try await history(from: sources) { |
|
|
|
|
print("dataFound.clubCode == clubCode", dataFound.clubCode, clubCode) |
|
|
|
|
isEQConfirmed = dataFound.clubCode == clubCode |
|
|
|
|
} else { |
|
|
|
|
print("not found") |
|
|
|
|
isEQConfirmed = nil |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func updateRank(from sources: [CSVParser], lastRank: Int) async throws { |
|
|
|
|
#if DEBUG_TIME //DEBUGING TIME |
|
|
|
|
let start = Date() |
|
|
|
|
|