|
|
|
|
@ -53,11 +53,12 @@ class Club : ModelObject, Storable, Hashable { |
|
|
|
|
self.broadcastCode = broadcastCode |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// override func onServerInsert(serverCopy: any Storable) -> Bool { |
|
|
|
|
// guard let copy = serverCopy as? Club else { return false } |
|
|
|
|
// self.broadcastCode = copy.broadcastCode |
|
|
|
|
// return true |
|
|
|
|
// } |
|
|
|
|
override func copyFromServerInstance(_ instance: any Storable) -> Bool { |
|
|
|
|
guard let copy = instance as? Club else { return false } |
|
|
|
|
self.broadcastCode = copy.broadcastCode |
|
|
|
|
Logger.log("write code: \(self.broadcastCode)") |
|
|
|
|
return true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func clubTitle(_ displayStyle: DisplayStyle = .wide) -> String { |
|
|
|
|
switch displayStyle { |
|
|
|
|
@ -220,7 +221,7 @@ extension Club { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func isFavorite() -> Bool { |
|
|
|
|
return DataStore.shared.user.clubs.contains(where: { $0 == id }) |
|
|
|
|
return DataStore.shared.user.clubs.contains(where: { $0 == self.id }) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static func findOrCreate(name: String, code: String?, city: String? = nil, zipCode: String? = nil) -> Club { |
|
|
|
|
@ -238,4 +239,5 @@ extension Club { |
|
|
|
|
return Club(name: name, code: code) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|