diff --git a/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclient/data/NSDeviceStatusHandler.kt b/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclient/data/NSDeviceStatusHandler.kt index 53e35fe771..4a483991da 100644 --- a/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclient/data/NSDeviceStatusHandler.kt +++ b/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclient/data/NSDeviceStatusHandler.kt @@ -101,8 +101,8 @@ class NSDeviceStatusHandler @Inject constructor( } } - private fun updatePumpData(NSDeviceStatus: NSDeviceStatus) { - val pump = NSDeviceStatus.pump ?: return + private fun updatePumpData(nsDeviceStatus: NSDeviceStatus) { + val pump = nsDeviceStatus.pump ?: return val clock = pump.clock?.let { dateUtil.fromISODateString(it) } ?: return processedDeviceStatusData.pumpData?.let { if (clock < it.clock) return } // take only newer record @@ -134,8 +134,8 @@ class NSDeviceStatusHandler @Inject constructor( } } - private fun updateOpenApsData(NSDeviceStatus: NSDeviceStatus) { - NSDeviceStatus.openaps?.suggested?.let { + private fun updateOpenApsData(nsDeviceStatus: NSDeviceStatus) { + nsDeviceStatus.openaps?.suggested?.let { JsonHelper.safeGetString(it, "timestamp")?.let { timestamp -> val clock = dateUtil.fromISODateString(timestamp) // check if this is new data @@ -145,7 +145,7 @@ class NSDeviceStatusHandler @Inject constructor( } } } - NSDeviceStatus.openaps?.enacted?.let { + nsDeviceStatus.openaps?.enacted?.let { JsonHelper.safeGetString(it, "timestamp")?.let { timestamp -> val clock = dateUtil.fromISODateString(timestamp) // check if this is new data diff --git a/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclientV3/NSClientV3Plugin.kt b/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclientV3/NSClientV3Plugin.kt index 4c3a406753..39cdb45e81 100644 --- a/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclientV3/NSClientV3Plugin.kt +++ b/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclientV3/NSClientV3Plugin.kt @@ -649,6 +649,7 @@ class NSClientV3Plugin @Inject constructor( result.identifier?.let { dataPair.value.interfaceIDs.nightscoutId = it storeDataForDb.nsIdDeviceStatuses.add(dataPair.value) + sp.putBoolean(info.nightscout.core.utils.R.string.key_objectives_pump_status_is_available_in_ns, true) } } } catch (e: Exception) {