Skip to content

Commit

Permalink
fixing decoding times if times was never encoded error
Browse files Browse the repository at this point in the history
  • Loading branch information
apgupta3303 committed Mar 13, 2024
1 parent f5e284d commit 068fba5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/SpeziMedication/Models/Schedule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public struct Schedule: Codable, Equatable, Hashable {
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.frequency = try container.decode(Frequency.self, forKey: .frequency)
self.times = try container.decode([ScheduledTime].self, forKey: .times)
self.times = try container.decodeIfPresent([ScheduledTime].self, forKey: .times) ?? []

Check warning on line 41 in Sources/SpeziMedication/Models/Schedule.swift

View check run for this annotation

Codecov / codecov/patch

Sources/SpeziMedication/Models/Schedule.swift#L41

Added line #L41 was not covered by tests
self.startDate = try container.decode(Date.self, forKey: .startDate)
}

Expand Down

0 comments on commit 068fba5

Please sign in to comment.