@@ -46,6 +46,7 @@ extension MainViewController {
4646 func webLoadNSBGData( dexData: [ ShareGlucoseData ] = [ ] ) {
4747 // This kicks it out in the instance where dexcom fails but they aren't using NS &&
4848 if !IsNightscoutEnabled( ) {
49+ Storage . shared. lastBGChecked. value = Date ( )
4950 return
5051 }
5152
@@ -109,6 +110,8 @@ extension MainViewController {
109110 // if we have Dex data, use it
110111 if !dexData. isEmpty {
111112 self . ProcessDexBGData ( data: dexData, sourceName: " Dexcom " )
113+ } else {
114+ Storage . shared. lastBGChecked. value = Date ( )
112115 }
113116 return
114117 }
@@ -121,6 +124,7 @@ extension MainViewController {
121124
122125 guard !data. isEmpty else {
123126 LogManager . shared. log ( category: . nightscout, message: " No bg data received. Skipping processing. " , limitIdentifier: " No bg data received. Skipping processing. " )
127+ Storage . shared. lastBGChecked. value = Date ( )
124128 return
125129 }
126130
@@ -221,7 +225,10 @@ extension MainViewController {
221225 TaskScheduler . shared. rescheduleTask ( id: . minAgoUpdate, to: Date ( ) )
222226
223227 let entries = self . bgData
224- if entries. count < 2 { return } // Protect index out of bounds
228+ if entries. count < 2 { // Protect index out of bounds
229+ Storage . shared. lastBGChecked. value = Date ( )
230+ return
231+ }
225232
226233 self . updateBGGraph ( )
227234 self . updateStats ( )
@@ -264,6 +271,7 @@ extension MainViewController {
264271 stale: Observable . shared. bgStale. value
265272 )
266273 }
274+ Storage . shared. lastBGChecked. value = Date ( )
267275 }
268276 }
269277}
0 commit comments