This commit is contained in:
Trey t
2023-07-28 11:15:13 -05:00
parent 2dcd260887
commit 1997abeff6
13 changed files with 264 additions and 101 deletions

View File

@@ -25,7 +25,16 @@ class DataStore: ObservableObject {
private let fetchAllDataQueue = DispatchGroup()
public func fetchAllData() {
public var workoutsUniqueUsers: [RegisteredUser]? {
guard let workouts = allWorkouts else {
return nil
}
let users = workouts.compactMap({ $0.registeredUser })
return Array(Set(users))
}
public func fetchAllData(completion: @escaping (() -> Void)) {
status = .loading
fetchAllDataQueue.enter()
@@ -35,6 +44,7 @@ class DataStore: ObservableObject {
fetchAllDataQueue.notify(queue: .main) {
self.status = .idle
completion()
}
AllWorkoutFetchable().fetch(completion: { result in