From 430a87199325a6f39cd508898a02f8154c9a06b3 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sun, 18 Apr 2021 18:31:21 +0200 Subject: [PATCH] fix DeviceStatus upload --- .../plugins/general/food/FoodPlugin.kt | 4 ++-- .../general/nsclient/NSClientAddAckWorker.kt | 24 +++++++++---------- .../nsclient/NSClientAddUpdateWorker.kt | 12 +++++----- .../general/nsclient/NSClientMbgWorker.kt | 2 +- .../general/nsclient/NSClientRemoveWorker.kt | 12 +++++----- .../androidaps/plugins/source/DexcomPlugin.kt | 4 ++-- .../plugins/source/EversensePlugin.kt | 4 ++-- .../androidaps/plugins/source/GlimpPlugin.kt | 2 +- .../androidaps/plugins/source/MM640gPlugin.kt | 4 ++-- .../plugins/source/NSClientSourcePlugin.kt | 4 ++-- .../plugins/source/PoctechPlugin.kt | 4 ++-- .../androidaps/plugins/source/TomatoPlugin.kt | 2 +- .../androidaps/plugins/source/XdripPlugin.kt | 2 +- .../database/daos/DeviceStatusDao.kt | 4 ++-- 14 files changed, 42 insertions(+), 42 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodPlugin.kt index fefc9009c1..7b9de28680 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodPlugin.kt @@ -78,7 +78,7 @@ class FoodPlugin @Inject constructor( repository.runTransactionForResult(SyncNsFoodTransaction(delFood, true)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while removing food", it) - ret = Result.failure(workDataOf("Error" to it)) + ret = Result.failure(workDataOf("Error" to it.toString())) } .blockingGet() .also { @@ -92,7 +92,7 @@ class FoodPlugin @Inject constructor( repository.runTransactionForResult(SyncNsFoodTransaction(food, false)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while adding/updating food", it) - ret = Result.failure(workDataOf("Error" to it)) + ret = Result.failure(workDataOf("Error" to it.toString())) } .blockingGet() .also { result -> diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddAckWorker.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddAckWorker.kt index e07346e85b..4b89e51d0b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddAckWorker.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddAckWorker.kt @@ -44,7 +44,7 @@ class NSClientAddAckWorker( repository.runTransactionForResult(UpdateNsIdTemporaryTargetTransaction(pair.value)) .doOnError { error -> aapsLogger.error(LTag.DATABASE, "Updated ns id of TemporaryTarget failed", error) - ret = Result.failure((workDataOf("Error" to error))) + ret = Result.failure((workDataOf("Error" to error.toString()))) } .doOnSuccess { ret = Result.success(workDataOf("ProcessedData" to pair.toString())) @@ -63,7 +63,7 @@ class NSClientAddAckWorker( repository.runTransactionForResult(UpdateNsIdGlucoseValueTransaction(pair.value)) .doOnError { error -> aapsLogger.error(LTag.DATABASE, "Updated ns id of GlucoseValue failed", error) - ret = Result.failure((workDataOf("Error" to error))) + ret = Result.failure((workDataOf("Error" to error.toString()))) } .doOnSuccess { ret = Result.success(workDataOf("ProcessedData" to pair.toString())) @@ -82,7 +82,7 @@ class NSClientAddAckWorker( repository.runTransactionForResult(UpdateNsIdFoodTransaction(pair.value)) .doOnError { error -> aapsLogger.error(LTag.DATABASE, "Updated ns id of Food failed", error) - ret = Result.failure((workDataOf("Error" to error))) + ret = Result.failure((workDataOf("Error" to error.toString()))) } .doOnSuccess { ret = Result.success(workDataOf("ProcessedData" to pair.toString())) @@ -101,7 +101,7 @@ class NSClientAddAckWorker( repository.runTransactionForResult(UpdateNsIdTherapyEventTransaction(pair.value)) .doOnError { error -> aapsLogger.error(LTag.DATABASE, "Updated ns id of TherapyEvent failed", error) - ret = Result.failure((workDataOf("Error" to error))) + ret = Result.failure((workDataOf("Error" to error.toString()))) } .doOnSuccess { ret = Result.success(workDataOf("ProcessedData" to pair.toString())) @@ -120,7 +120,7 @@ class NSClientAddAckWorker( repository.runTransactionForResult(UpdateNsIdBolusTransaction(pair.value)) .doOnError { error -> aapsLogger.error(LTag.DATABASE, "Updated ns id of Bolus failed", error) - ret = Result.failure((workDataOf("Error" to error))) + ret = Result.failure((workDataOf("Error" to error.toString()))) } .doOnSuccess { ret = Result.success(workDataOf("ProcessedData" to pair.toString())) @@ -139,7 +139,7 @@ class NSClientAddAckWorker( repository.runTransactionForResult(UpdateNsIdCarbsTransaction(pair.value)) .doOnError { error -> aapsLogger.error(LTag.DATABASE, "Updated ns id of Carbs failed", error) - ret = Result.failure((workDataOf("Error" to error))) + ret = Result.failure((workDataOf("Error" to error.toString()))) } .doOnSuccess { ret = Result.success(workDataOf("ProcessedData" to pair.toString())) @@ -158,7 +158,7 @@ class NSClientAddAckWorker( repository.runTransactionForResult(UpdateNsIdBolusCalculatorResultTransaction(pair.value)) .doOnError { error -> aapsLogger.error(LTag.DATABASE, "Updated ns id of BolusCalculatorResult failed", error) - ret = Result.failure((workDataOf("Error" to error))) + ret = Result.failure((workDataOf("Error" to error.toString()))) } .doOnSuccess { ret = Result.success(workDataOf("ProcessedData" to pair.toString())) @@ -177,7 +177,7 @@ class NSClientAddAckWorker( repository.runTransactionForResult(UpdateNsIdTemporaryBasalTransaction(pair.value)) .doOnError { error -> aapsLogger.error(LTag.DATABASE, "Updated ns id of TemporaryBasal failed", error) - ret = Result.failure((workDataOf("Error" to error))) + ret = Result.failure((workDataOf("Error" to error.toString()))) } .doOnSuccess { ret = Result.success(workDataOf("ProcessedData" to pair.toString())) @@ -196,7 +196,7 @@ class NSClientAddAckWorker( repository.runTransactionForResult(UpdateNsIdExtendedBolusTransaction(pair.value)) .doOnError { error -> aapsLogger.error(LTag.DATABASE, "Updated ns id of ExtendedBolus failed", error) - ret = Result.failure((workDataOf("Error" to error))) + ret = Result.failure((workDataOf("Error" to error.toString()))) } .doOnSuccess { ret = Result.success(workDataOf("ProcessedData" to pair.toString())) @@ -215,17 +215,17 @@ class NSClientAddAckWorker( repository.runTransactionForResult(UpdateNsIdDeviceStatusTransaction(deviceStatus)) .doOnError { error -> aapsLogger.error(LTag.DATABASE, "Updated ns id of DeviceStatus failed", error) - ret = Result.failure((workDataOf("Error" to error))) + ret = Result.failure((workDataOf("Error" to error.toString()))) } .doOnSuccess { - ret = Result.success(workDataOf("ProcessedData" to deviceStatus)) + ret = Result.success(workDataOf("ProcessedData" to deviceStatus.toString())) aapsLogger.debug(LTag.DATABASE, "Updated ns id of DeviceStatus $deviceStatus") dataSyncSelector.confirmLastDeviceStatusIdIfGreater(deviceStatus.id) } .blockingGet() rxBus.send(EventNSClientNewLog("DBADD", "Acked DeviceStatus" + deviceStatus.interfaceIDs.nightscoutId)) // Send new if waiting - dataSyncSelector.processChangedBolusCalculatorResultsCompat() + dataSyncSelector.processChangedDeviceStatusesCompat() } } return ret diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt index 89b30d8b8e..5f46565977 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt @@ -79,7 +79,7 @@ class NSClientAddUpdateWorker( repository.runTransactionForResult(SyncNsBolusTransaction(bolus, invalidateByNsOnly = false)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving bolus", it) - ret = Result.failure(workDataOf("Error" to it)) + ret = Result.failure(workDataOf("Error" to it.toString())) } .blockingGet() .also { result -> @@ -108,7 +108,7 @@ class NSClientAddUpdateWorker( repository.runTransactionForResult(SyncNsCarbsTransaction(carb, invalidateByNsOnly = false)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving carbs", it) - ret = Result.failure(workDataOf("Error" to it)) + ret = Result.failure(workDataOf("Error" to it.toString())) } .blockingGet() .also { result -> @@ -146,7 +146,7 @@ class NSClientAddUpdateWorker( repository.runTransactionForResult(SyncNsTemporaryTargetTransaction(temporaryTarget, invalidateByNsOnly = false)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving temporary target", it) - ret = Result.failure(workDataOf("Error" to it)) + ret = Result.failure(workDataOf("Error" to it.toString())) } .blockingGet() .also { result -> @@ -196,7 +196,7 @@ class NSClientAddUpdateWorker( repository.runTransactionForResult(SyncNsTherapyEventTransaction(therapyEvent, invalidateByNsOnly = false)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving therapy event", it) - ret = Result.failure(workDataOf("Error" to it)) + ret = Result.failure(workDataOf("Error" to it.toString())) } .blockingGet() .also { result -> @@ -231,7 +231,7 @@ class NSClientAddUpdateWorker( repository.runTransactionForResult(SyncNsExtendedBolusTransaction(extendedBolus, invalidateByNsOnly = false)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving extended bolus", it) - ret = Result.failure(workDataOf("Error" to it)) + ret = Result.failure(workDataOf("Error" to it.toString())) } .blockingGet() .also { result -> @@ -272,7 +272,7 @@ class NSClientAddUpdateWorker( repository.runTransactionForResult(SyncNsTemporaryBasalTransaction(temporaryBasal, invalidateByNsOnly = false)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving temporary basal", it) - ret = Result.failure(workDataOf("Error" to it)) + ret = Result.failure(workDataOf("Error" to it.toString())) } .blockingGet() .also { result -> diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientMbgWorker.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientMbgWorker.kt index 9f61cf6092..a769f2ec38 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientMbgWorker.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientMbgWorker.kt @@ -44,7 +44,7 @@ class NSClientMbgWorker( repository.runTransactionForResult(SyncNsTherapyEventTransaction(therapyEventFromNsMbg(nsMbg), false)) .doOnError { aapsLogger.error("Error while saving therapy event", it) - ret = Result.failure(workDataOf("Error" to it)) + ret = Result.failure(workDataOf("Error" to it.toString())) } .blockingGet() .also { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientRemoveWorker.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientRemoveWorker.kt index e18708f7a0..014c49dea5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientRemoveWorker.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientRemoveWorker.kt @@ -61,7 +61,7 @@ class NSClientRemoveWorker( repository.runTransactionForResult(SyncNsTemporaryTargetTransaction(temporaryTarget, invalidateByNsOnly = true)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while invalidating temporary target", it) - ret = Result.failure(workDataOf("Error" to it)) + ret = Result.failure(workDataOf("Error" to it.toString())) } .blockingGet() .also { result -> @@ -81,7 +81,7 @@ class NSClientRemoveWorker( repository.runTransactionForResult(SyncNsTherapyEventTransaction(therapyEvent, invalidateByNsOnly = true)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while invalidating therapy event", it) - ret = Result.failure(workDataOf("Error" to it)) + ret = Result.failure(workDataOf("Error" to it.toString())) } .blockingGet() .also { result -> @@ -98,7 +98,7 @@ class NSClientRemoveWorker( repository.runTransactionForResult(SyncNsBolusTransaction(bolus, invalidateByNsOnly = true)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while invalidating bolus", it) - ret = Result.failure(workDataOf("Error" to it)) + ret = Result.failure(workDataOf("Error" to it.toString())) } .blockingGet() .also { result -> @@ -114,7 +114,7 @@ class NSClientRemoveWorker( repository.runTransactionForResult(SyncNsCarbsTransaction(carbs, invalidateByNsOnly = true)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while invalidating carbs", it) - ret = Result.failure(workDataOf("Error" to it)) + ret = Result.failure(workDataOf("Error" to it.toString())) } .blockingGet() .also { result -> @@ -130,7 +130,7 @@ class NSClientRemoveWorker( repository.runTransactionForResult(SyncNsTemporaryBasalTransaction(temporaryBasal, invalidateByNsOnly = true)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while invalidating temporary basal", it) - ret = Result.failure(workDataOf("Error" to it)) + ret = Result.failure(workDataOf("Error" to it.toString())) } .blockingGet() .also { result -> @@ -146,7 +146,7 @@ class NSClientRemoveWorker( repository.runTransactionForResult(SyncNsExtendedBolusTransaction(extendedBolus, invalidateByNsOnly = true)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while invalidating extended bolus", it) - ret = Result.failure(workDataOf("Error" to it)) + ret = Result.failure(workDataOf("Error" to it.toString())) } .blockingGet() .also { result -> diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt index d28aa3fa4f..e7c9f06407 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt @@ -144,7 +144,7 @@ class DexcomPlugin @Inject constructor( repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, calibrations, sensorStartTime)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving values from Dexcom App", it) - ret = Result.failure(workDataOf("Error" to it)) + ret = Result.failure(workDataOf("Error" to it.toString())) } .blockingGet() .also { result -> @@ -173,7 +173,7 @@ class DexcomPlugin @Inject constructor( } } catch (e: Exception) { aapsLogger.error("Error while processing intent from Dexcom App", e) - ret = Result.failure(workDataOf("Error" to e)) + ret = Result.failure(workDataOf("Error" to e.toString())) } return ret } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/EversensePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/EversensePlugin.kt index c6d0467c78..434e5eb873 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/EversensePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/EversensePlugin.kt @@ -112,7 +112,7 @@ class EversensePlugin @Inject constructor( repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, emptyList(), null)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving values from Eversense App", it) - ret = Result.failure(workDataOf("Error" to it)) + ret = Result.failure(workDataOf("Error" to it.toString())) } .blockingGet() .also { savedValues -> @@ -142,7 +142,7 @@ class EversensePlugin @Inject constructor( )) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving therapy event", it) - ret = Result.failure(workDataOf("Error" to it)) + ret = Result.failure(workDataOf("Error" to it.toString())) } .blockingGet() .also { result -> diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/GlimpPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/GlimpPlugin.kt index dcd6690163..36724eb4b5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/GlimpPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/GlimpPlugin.kt @@ -70,7 +70,7 @@ class GlimpPlugin @Inject constructor( repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, emptyList(), null)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving values from Glimp App", it) - ret = Result.failure(workDataOf("Error" to it)) + ret = Result.failure(workDataOf("Error" to it.toString())) } .blockingGet() .also { savedValues -> diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/MM640gPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/MM640gPlugin.kt index 41d4defeeb..728e9c12c9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/MM640gPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/MM640gPlugin.kt @@ -88,7 +88,7 @@ class MM640gPlugin @Inject constructor( repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, emptyList(), null)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving values from Eversense App", it) - ret = Result.failure(workDataOf("Error" to it)) + ret = Result.failure(workDataOf("Error" to it.toString())) } .blockingGet() .also { savedValues -> @@ -99,7 +99,7 @@ class MM640gPlugin @Inject constructor( } } catch (e: JSONException) { aapsLogger.error("Exception: ", e) - ret = Result.failure(workDataOf("Error" to e)) + ret = Result.failure(workDataOf("Error" to e.toString())) } } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/NSClientSourcePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/NSClientSourcePlugin.kt index 4866cc7f9e..d9c2f221e5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/NSClientSourcePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/NSClientSourcePlugin.kt @@ -142,7 +142,7 @@ class NSClientSourcePlugin @Inject constructor( repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, emptyList(), null, !nsClientSourcePlugin.isEnabled())) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving values from NSClient App", it) - ret = Result.failure(workDataOf("Error" to it)) + ret = Result.failure(workDataOf("Error" to it.toString())) } .blockingGet() .also { result -> @@ -159,7 +159,7 @@ class NSClientSourcePlugin @Inject constructor( } } catch (e: Exception) { aapsLogger.error("Unhandled exception", e) - ret = Result.failure(workDataOf("Error" to e)) + ret = Result.failure(workDataOf("Error" to e.toString())) } // Objectives 0 sp.putBoolean(R.string.key_ObjectivesbgIsAvailableInNS, true) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/PoctechPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/PoctechPlugin.kt index bcec10bd5d..17aefac5b5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/PoctechPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/PoctechPlugin.kt @@ -81,7 +81,7 @@ class PoctechPlugin @Inject constructor( repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, emptyList(), null)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving values from Poctech App", it) - ret = Result.failure(workDataOf("Error" to it)) + ret = Result.failure(workDataOf("Error" to it.toString())) } .blockingGet() .also { savedValues -> @@ -92,7 +92,7 @@ class PoctechPlugin @Inject constructor( } } catch (e: JSONException) { aapsLogger.error("Exception: ", e) - ret = Result.failure(workDataOf("Error" to e)) + ret = Result.failure(workDataOf("Error" to e.toString())) } return ret } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/TomatoPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/TomatoPlugin.kt index bbcc7ccc49..cf6fce3da5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/TomatoPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/TomatoPlugin.kt @@ -72,7 +72,7 @@ class TomatoPlugin @Inject constructor( repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, emptyList(), null)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving values from Tomato App", it) - ret = Result.failure(workDataOf("Error" to it)) + ret = Result.failure(workDataOf("Error" to it.toString())) } .blockingGet() .also { savedValues -> diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/XdripPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/XdripPlugin.kt index be7df833e9..622d69c284 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/XdripPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/XdripPlugin.kt @@ -91,7 +91,7 @@ class XdripPlugin @Inject constructor( repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, emptyList(), null)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving values from Xdrip", it) - ret = Result.failure(workDataOf("Error" to it)) + ret = Result.failure(workDataOf("Error" to it.toString())) } .blockingGet() .also { savedValues -> diff --git a/database/src/main/java/info/nightscout/androidaps/database/daos/DeviceStatusDao.kt b/database/src/main/java/info/nightscout/androidaps/database/daos/DeviceStatusDao.kt index d34edc36d2..239081d607 100644 --- a/database/src/main/java/info/nightscout/androidaps/database/daos/DeviceStatusDao.kt +++ b/database/src/main/java/info/nightscout/androidaps/database/daos/DeviceStatusDao.kt @@ -32,10 +32,10 @@ internal interface DeviceStatusDao { fun findByNSId(nsId: String): DeviceStatus? // This query will be used with v3 to get all changed records - @Query("SELECT * FROM $TABLE_DEVICE_STATUS WHERE id > :id ORDER BY id ASC") + @Query("SELECT * FROM $TABLE_DEVICE_STATUS WHERE id > :id AND nightscoutId IS NULL ORDER BY id ASC") fun getModifiedFrom(id: Long): Single> // for WS we need 1 record only - @Query("SELECT * FROM $TABLE_DEVICE_STATUS WHERE id > :id ORDER BY id ASC limit 1") + @Query("SELECT * FROM $TABLE_DEVICE_STATUS WHERE id > :id AND nightscoutId IS NULL ORDER BY id ASC limit 1") fun getNextModifiedOrNewAfter(id: Long): Maybe } \ No newline at end of file