|
|
|
|
@ -473,6 +473,8 @@ class FileImportManager { |
|
|
|
|
let licenceId : String? = data[safe: 7]?.prefixTrimmed(50) |
|
|
|
|
let club : String? = data[safe: 8]?.prefixTrimmed(200) |
|
|
|
|
let status : String? = data[safe: 9] |
|
|
|
|
let verified : String? = data[safe: 10] |
|
|
|
|
let isVerified = verified == "ok" |
|
|
|
|
if chunkMode == .byColumn { |
|
|
|
|
let predicate = NSPredicate(format: "license == %@", licenceId!.strippedLicense!) |
|
|
|
|
fetchRequest.predicate = predicate |
|
|
|
|
@ -483,11 +485,17 @@ class FileImportManager { |
|
|
|
|
player.sourceName = lastName |
|
|
|
|
player.isNVEQ = status == "NVEQ" |
|
|
|
|
player.clubCode = found.clubCode |
|
|
|
|
if isVerified { |
|
|
|
|
player.source = .frenchFederationVerified |
|
|
|
|
} |
|
|
|
|
return player |
|
|
|
|
} else { |
|
|
|
|
let player = PlayerRegistration(firstName: firstName, lastName: lastName, licenceId: licenceId, rank: rank, sex: sex, clubName: club, phoneNumber: phoneNumber, email: email) |
|
|
|
|
player.sourceName = lastName |
|
|
|
|
player.isNVEQ = status == "NVEQ" |
|
|
|
|
if isVerified { |
|
|
|
|
player.source = .frenchFederationVerified |
|
|
|
|
} |
|
|
|
|
if rank == nil { |
|
|
|
|
player.setComputedRank(in: tournament) |
|
|
|
|
} else { |
|
|
|
|
@ -574,12 +582,14 @@ extension Array where Element == String { |
|
|
|
|
let sex = teamType.lowercased().contains("dames") ? "f" : "m" |
|
|
|
|
|
|
|
|
|
// Process up to 10 players |
|
|
|
|
let count = 6 |
|
|
|
|
for i in 0..<10 { |
|
|
|
|
let lastNameIndex = 12 + (i * 5) |
|
|
|
|
let firstNameIndex = 13 + (i * 5) |
|
|
|
|
let licenseIndex = 14 + (i * 5) |
|
|
|
|
let rankingIndex = 15 + (i * 5) |
|
|
|
|
let statusIndex = 16 + (i * 5) |
|
|
|
|
let lastNameIndex = 12 + (i * count) |
|
|
|
|
let firstNameIndex = 13 + (i * count) |
|
|
|
|
let validationStatusIndex = 14 + (i * count) |
|
|
|
|
let licenseIndex = 15 + (i * count) |
|
|
|
|
let rankingIndex = 16 + (i * count) |
|
|
|
|
let statusIndex = 17 + (i * count) |
|
|
|
|
|
|
|
|
|
guard lastNameIndex < components.count, |
|
|
|
|
!components[lastNameIndex].isEmpty else { |
|
|
|
|
@ -609,7 +619,8 @@ extension Array where Element == String { |
|
|
|
|
ranking: nil, |
|
|
|
|
status: status, |
|
|
|
|
email: nil, |
|
|
|
|
mobileNumber: nil |
|
|
|
|
mobileNumber: nil, |
|
|
|
|
validationStatus: components[validationStatusIndex] |
|
|
|
|
) |
|
|
|
|
players.append(player) |
|
|
|
|
} |
|
|
|
|
@ -668,6 +679,7 @@ struct PlayerChampionship { |
|
|
|
|
let status: Status |
|
|
|
|
let email: String? |
|
|
|
|
let mobileNumber: String? |
|
|
|
|
let validationStatus: String? |
|
|
|
|
|
|
|
|
|
static func captain(_ components: [String]) -> PlayerChampionship { |
|
|
|
|
let fullName = components[6].components(separatedBy: " ") |
|
|
|
|
@ -681,7 +693,8 @@ struct PlayerChampionship { |
|
|
|
|
ranking: 0, |
|
|
|
|
status: .captain, |
|
|
|
|
email: components[8], |
|
|
|
|
mobileNumber: components[7] |
|
|
|
|
mobileNumber: components[7], |
|
|
|
|
validationStatus: nil |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -697,7 +710,8 @@ struct PlayerChampionship { |
|
|
|
|
ranking: 0, |
|
|
|
|
status: .coach, |
|
|
|
|
email: components[11], |
|
|
|
|
mobileNumber: components[10] |
|
|
|
|
mobileNumber: components[10], |
|
|
|
|
validationStatus: nil |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -712,7 +726,8 @@ struct PlayerChampionship { |
|
|
|
|
"", |
|
|
|
|
licenseNumber.replaceCharactersFromSet(characterSet: .whitespacesAndNewlines), |
|
|
|
|
"", |
|
|
|
|
status.rawValue |
|
|
|
|
status.rawValue, |
|
|
|
|
validationStatus ?? "" |
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
return components.joined(separator: separator) |
|
|
|
|
|