Skip to content

Commit 028c95f

Browse files
committed
Rearrange testing of override end date
1 parent 3f33e04 commit 028c95f

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

Loop/Managers/WatchDataManager.swift

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,14 @@ final class WatchDataManager: NSObject, WCSessionDelegate {
142142
endDate: override.end
143143
)
144144

145-
context.temporaryOverride = WatchDatedRange(
146-
startDate: override.start,
147-
endDate: override.end ?? .distantFuture,
148-
minValue: override.value.minValue,
149-
maxValue: override.value.maxValue
150-
)
151-
152-
if (context.temporaryOverride?.endDate)! < Date() {
153-
context.temporaryOverride = nil
145+
let endDate = override.end ?? .distantFuture
146+
if endDate > Date() {
147+
context.temporaryOverride = WatchDatedRange(
148+
startDate: override.start,
149+
endDate: endDate,
150+
minValue: override.value.minValue,
151+
maxValue: override.value.maxValue
152+
)
154153
}
155154
}
156155

0 commit comments

Comments
 (0)