Skip to content

Commit 44c42aa

Browse files
authored
Merge pull request #323 from zibra/tprzysiwek/1minute-referesh-fix
fix: 1 minute refresh rate settings not being used
2 parents 7a55342 + a6732b3 commit 44c42aa

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

nightguard/app/NightscoutData.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,10 @@ class NightscoutData : NSObject, Codable, NSSecureCoding {
161161

162162
func isOlderThanYMinutes() -> Bool {
163163
if UserDefaultsRepository.checkBGEveryMinute.value == true {
164-
isOlderThan1Minute()
165-
} else {
166-
isOlderThan5Minutes()
164+
return isOlderThan1Minute()
167165
}
166+
167+
return isOlderThan5Minutes()
168168
}
169169

170170
func isOlderThan1Minute() -> Bool {

nightguard/external/NightscoutCacheService.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ class NightscoutCacheService: NSObject {
172172
serialQueue.sync {
173173
todaysBgData = removeYesterdaysEntries(bgValues: todaysBgData)
174174

175-
if todaysBgData.count == 0 || currentNightscoutData.isOlderThan5Minutes()
175+
if todaysBgData.count == 0 || currentNightscoutData.isOlderThanYMinutes()
176176
|| currentNightscoutWasFetchedInBackground(todaysBgData: todaysBgData) {
177177

178178
if let task = NightscoutService.singleton.readTodaysChartData(oldValues: todaysBgData, { [unowned self] (result: NightscoutRequestResult<[BloodSugar]>) in
@@ -292,7 +292,7 @@ class NightscoutCacheService: NSObject {
292292

293293
fileprivate func checkIfRefreshIsNeeded(_ resultHandler : @escaping (NightscoutRequestResult<NightscoutData>?) -> Void, forceRefresh: Bool = false) {
294294

295-
guard forceRefresh || currentNightscoutData.isOlderThan5Minutes() else {
295+
guard forceRefresh || currentNightscoutData.isOlderThanYMinutes() else {
296296
resultHandler(nil)
297297
return
298298
}

0 commit comments

Comments
 (0)