|
|
|
|
@ -33,13 +33,9 @@ struct TournamentLookUpView: View { |
|
|
|
|
Binding { |
|
|
|
|
locationManager.lastError != nil |
|
|
|
|
} set: { value in |
|
|
|
|
if value == false { |
|
|
|
|
locationManager.lastError = nil |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var body: some View { |
|
|
|
|
List { |
|
|
|
|
searchParametersView |
|
|
|
|
@ -182,6 +178,9 @@ struct TournamentLookUpView: View { |
|
|
|
|
federalDataViewModel.searchAttemptCount += 1 |
|
|
|
|
federalDataViewModel.dayPeriod = dataStore.appSettings.dayPeriod |
|
|
|
|
federalDataViewModel.dayDuration = dataStore.appSettings.dayDuration |
|
|
|
|
federalDataViewModel.levels = Set(levels) |
|
|
|
|
federalDataViewModel.categories = Set(categories) |
|
|
|
|
federalDataViewModel.ageCategories = Set(ages) |
|
|
|
|
|
|
|
|
|
Task { |
|
|
|
|
await getNewPage() |
|
|
|
|
@ -227,6 +226,12 @@ struct TournamentLookUpView: View { |
|
|
|
|
let resultCommand = commands.first(where: { $0.results != nil }) |
|
|
|
|
if let newTournaments = resultCommand?.results?.items { |
|
|
|
|
newTournaments.forEach { ft in |
|
|
|
|
// let isValid = ft.tournaments.anySatisfy({ build in |
|
|
|
|
// let ageValid = ages.isEmpty ? true : ages.contains(build.age) |
|
|
|
|
// let levelValid = levels.isEmpty ? true : levels.contains(build.level) |
|
|
|
|
// let categoryValid = categories.isEmpty ? true : categories.contains(build.category) |
|
|
|
|
// return ageValid && levelValid && categoryValid |
|
|
|
|
// }) |
|
|
|
|
if tournaments.contains(where: { $0.id == ft.id }) == false { |
|
|
|
|
federalDataViewModel.searchedFederalTournaments.append(ft) |
|
|
|
|
} |
|
|
|
|
|