This commit is contained in:
Trey t
2023-07-10 15:35:48 -05:00
parent a2098943a8
commit 93cab684b9
10 changed files with 220 additions and 100 deletions

View File

@@ -14,7 +14,7 @@ struct CompletedWorkout: Codable {
let difficulty, totalTime: Int?
let workoutStartTime: String
let notes: String?
let totalCalories: Int?
let totalCalories: Float?
enum CodingKeys: String, CodingKey {
case id, workout

View File

@@ -25,6 +25,26 @@ struct ExerciseElement: Codable, Equatable {
}
}
extension ExerciseElement {
func videoURL(nsfw: Bool) -> URL? {
var _url: URL?
if nsfw {
let viddd = exercise.nsfwVideoURL
if let url = URL(string: BaseURLs.currentBaseURL + viddd) {
_url = url
}
} else {
let viddd = exercise.videoURL
if let url = URL(string: BaseURLs.currentBaseURL + viddd) {
_url = url
}
}
return _url
}
}
struct ExerciseExercise: Codable, Hashable, Identifiable {
static func == (lhs: ExerciseExercise, rhs: ExerciseExercise) -> Bool {
lhs.id == rhs.id
@@ -62,3 +82,23 @@ struct ExerciseExercise: Codable, Hashable, Identifiable {
case nsfwVideoURL = "nsfw_video_url"
}
}
extension ExerciseExercise {
func videoURL(nsfw: Bool) -> URL? {
var _url: URL?
if nsfw {
let viddd = nsfwVideoURL
if let url = URL(string: BaseURLs.currentBaseURL + viddd) {
_url = url
}
} else {
let viddd = videoURL
if let url = URL(string: BaseURLs.currentBaseURL + viddd) {
_url = url
}
}
return _url
}
}