|
|
|
@ -181,6 +181,7 @@ struct TournamentLookUpView: View { |
|
|
|
federalDataViewModel.levels = Set(levels) |
|
|
|
federalDataViewModel.levels = Set(levels) |
|
|
|
federalDataViewModel.categories = Set(categories) |
|
|
|
federalDataViewModel.categories = Set(categories) |
|
|
|
federalDataViewModel.ageCategories = Set(ages) |
|
|
|
federalDataViewModel.ageCategories = Set(ages) |
|
|
|
|
|
|
|
federalDataViewModel.lastError = nil |
|
|
|
|
|
|
|
|
|
|
|
Task { |
|
|
|
Task { |
|
|
|
await getNewPage() |
|
|
|
await getNewPage() |
|
|
|
@ -223,7 +224,12 @@ struct TournamentLookUpView: View { |
|
|
|
await getNewBuildForm() |
|
|
|
await getNewBuildForm() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
let commands = try await NetworkFederalService.shared.getAllFederalTournaments(sortingOption: dataStore.appSettings.sortingOption, page: page, startDate: dataStore.appSettings.startDate, endDate: dataStore.appSettings.endDate, city: dataStore.appSettings.city, distance: dataStore.appSettings.distance, categories: categories, levels: levels, lat: locationManager.location?.coordinate.latitude.formatted(.number.locale(Locale(identifier: "us"))), lng: locationManager.location?.coordinate.longitude.formatted(.number.locale(Locale(identifier: "us"))), ages: ages, types: types, nationalCup: dataStore.appSettings.nationalCup) |
|
|
|
let commands = try await NetworkFederalService.shared.getAllFederalTournaments(sortingOption: dataStore.appSettings.sortingOption, page: page, startDate: dataStore.appSettings.startDate, endDate: dataStore.appSettings.endDate, city: dataStore.appSettings.city, distance: dataStore.appSettings.distance, categories: categories, levels: levels, lat: locationManager.location?.coordinate.latitude.formatted(.number.locale(Locale(identifier: "us"))), lng: locationManager.location?.coordinate.longitude.formatted(.number.locale(Locale(identifier: "us"))), ages: ages, types: types, nationalCup: dataStore.appSettings.nationalCup) |
|
|
|
|
|
|
|
if commands.anySatisfy({ $0.command == "alert" }) { |
|
|
|
|
|
|
|
federalDataViewModel.lastError = .maintenance |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let resultCommand = commands.first(where: { $0.results != nil }) |
|
|
|
let resultCommand = commands.first(where: { $0.results != nil }) |
|
|
|
|
|
|
|
|
|
|
|
if let newTournaments = resultCommand?.results?.items { |
|
|
|
if let newTournaments = resultCommand?.results?.items { |
|
|
|
newTournaments.forEach { ft in |
|
|
|
newTournaments.forEach { ft in |
|
|
|
// let isValid = ft.tournaments.anySatisfy({ build in |
|
|
|
// let isValid = ft.tournaments.anySatisfy({ build in |
|
|
|
|