|
|
|
|
@ -247,9 +247,9 @@ struct InscriptionManagerView: View { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if tournament.enableOnlineRegistration { |
|
|
|
|
RowButtonView("Rafraîchir la liste", cornerRadius: 20) { |
|
|
|
|
await _refreshList(forced: true) |
|
|
|
|
} |
|
|
|
|
// RowButtonView("Rafraîchir la liste", cornerRadius: 20) { |
|
|
|
|
// await _refreshList(forced: true) |
|
|
|
|
// } |
|
|
|
|
} else if tournament.onlineRegistrationCanBeEnabled() { |
|
|
|
|
RowButtonView("Inscription en ligne") { |
|
|
|
|
navigation.path.append(Screen.settings) |
|
|
|
|
@ -261,12 +261,12 @@ struct InscriptionManagerView: View { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.task(priority: .background) { |
|
|
|
|
await _refreshList(forced: false) |
|
|
|
|
} |
|
|
|
|
.refreshable { |
|
|
|
|
await _refreshList(forced: true) |
|
|
|
|
} |
|
|
|
|
// .task(priority: .background) { |
|
|
|
|
// await _refreshList(forced: false) |
|
|
|
|
// } |
|
|
|
|
// .refreshable { |
|
|
|
|
// await _refreshList(forced: true) |
|
|
|
|
// } |
|
|
|
|
.onAppear { |
|
|
|
|
if tournament.enableOnlineRegistration == false || refreshStatus == true { |
|
|
|
|
_setHash(currentSelectedSortedTeams: selectedSortedTeams) |
|
|
|
|
@ -581,31 +581,31 @@ struct InscriptionManagerView: View { |
|
|
|
|
// try? tournamentStore.playerRegistrations.addOrUpdate(contentOfs: players) |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
private func _refreshList(forced: Bool) async { |
|
|
|
|
if refreshStatus == true, forced == false { return } |
|
|
|
|
if tournament.enableOnlineRegistration == false { return } |
|
|
|
|
if tournament.hasEnded() { return } |
|
|
|
|
if tournament.refreshInProgress { return } |
|
|
|
|
|
|
|
|
|
refreshResult = nil |
|
|
|
|
refreshStatus = nil |
|
|
|
|
do { |
|
|
|
|
await self.tournament.refreshTeamList(forced: forced) |
|
|
|
|
|
|
|
|
|
_setHash() |
|
|
|
|
if let lastTeamRefresh = self.tournament.lastTeamRefresh?.formatted(date: .abbreviated, time: .shortened) { |
|
|
|
|
self.refreshResult = "Dernière m-à-j : \(lastTeamRefresh)" |
|
|
|
|
} else { |
|
|
|
|
self.refreshResult = "La synchronization a réussi" |
|
|
|
|
} |
|
|
|
|
self.refreshStatus = true |
|
|
|
|
|
|
|
|
|
} catch { |
|
|
|
|
Logger.error(error) |
|
|
|
|
self.refreshResult = "La synchronization a échoué" |
|
|
|
|
self.refreshStatus = false |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// private func _refreshList(forced: Bool) async { |
|
|
|
|
// if refreshStatus == true, forced == false { return } |
|
|
|
|
// if tournament.enableOnlineRegistration == false { return } |
|
|
|
|
// if tournament.hasEnded() { return } |
|
|
|
|
// if tournament.refreshInProgress { return } |
|
|
|
|
// |
|
|
|
|
// refreshResult = nil |
|
|
|
|
// refreshStatus = nil |
|
|
|
|
// do { |
|
|
|
|
// await self.tournament.refreshTeamList(forced: forced) |
|
|
|
|
// |
|
|
|
|
// _setHash() |
|
|
|
|
// if let lastTeamRefresh = self.tournament.lastTeamRefresh?.formatted(date: .abbreviated, time: .shortened) { |
|
|
|
|
// self.refreshResult = "Dernière m-à-j : \(lastTeamRefresh)" |
|
|
|
|
// } else { |
|
|
|
|
// self.refreshResult = "La synchronization a réussi" |
|
|
|
|
// } |
|
|
|
|
// self.refreshStatus = true |
|
|
|
|
// |
|
|
|
|
// } catch { |
|
|
|
|
// Logger.error(error) |
|
|
|
|
// self.refreshResult = "La synchronization a échoué" |
|
|
|
|
// self.refreshStatus = false |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
private func _teamRegisteredView(selectedSortedTeams: [TeamRegistration]) -> some View { |
|
|
|
|
List { |
|
|
|
|
@ -896,9 +896,9 @@ struct InscriptionManagerView: View { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
RowButtonView("Rafraîchir les inscriptions en ligne") { |
|
|
|
|
await _refreshList(forced: true) |
|
|
|
|
} |
|
|
|
|
// RowButtonView("Rafraîchir les inscriptions en ligne") { |
|
|
|
|
// await _refreshList(forced: true) |
|
|
|
|
// } |
|
|
|
|
} |
|
|
|
|
} header: { |
|
|
|
|
HStack { |
|
|
|
|
|