fix DeviceStatus upload

This commit is contained in:
Milos Kozak 2021-04-18 18:31:21 +02:00
parent 3928b579a7
commit 430a871993
14 changed files with 42 additions and 42 deletions

View file

@ -78,7 +78,7 @@ class FoodPlugin @Inject constructor(
repository.runTransactionForResult(SyncNsFoodTransaction(delFood, true)) repository.runTransactionForResult(SyncNsFoodTransaction(delFood, true))
.doOnError { .doOnError {
aapsLogger.error(LTag.DATABASE, "Error while removing food", it) 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() .blockingGet()
.also { .also {
@ -92,7 +92,7 @@ class FoodPlugin @Inject constructor(
repository.runTransactionForResult(SyncNsFoodTransaction(food, false)) repository.runTransactionForResult(SyncNsFoodTransaction(food, false))
.doOnError { .doOnError {
aapsLogger.error(LTag.DATABASE, "Error while adding/updating food", it) 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() .blockingGet()
.also { result -> .also { result ->

View file

@ -44,7 +44,7 @@ class NSClientAddAckWorker(
repository.runTransactionForResult(UpdateNsIdTemporaryTargetTransaction(pair.value)) repository.runTransactionForResult(UpdateNsIdTemporaryTargetTransaction(pair.value))
.doOnError { error -> .doOnError { error ->
aapsLogger.error(LTag.DATABASE, "Updated ns id of TemporaryTarget failed", 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 { .doOnSuccess {
ret = Result.success(workDataOf("ProcessedData" to pair.toString())) ret = Result.success(workDataOf("ProcessedData" to pair.toString()))
@ -63,7 +63,7 @@ class NSClientAddAckWorker(
repository.runTransactionForResult(UpdateNsIdGlucoseValueTransaction(pair.value)) repository.runTransactionForResult(UpdateNsIdGlucoseValueTransaction(pair.value))
.doOnError { error -> .doOnError { error ->
aapsLogger.error(LTag.DATABASE, "Updated ns id of GlucoseValue failed", 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 { .doOnSuccess {
ret = Result.success(workDataOf("ProcessedData" to pair.toString())) ret = Result.success(workDataOf("ProcessedData" to pair.toString()))
@ -82,7 +82,7 @@ class NSClientAddAckWorker(
repository.runTransactionForResult(UpdateNsIdFoodTransaction(pair.value)) repository.runTransactionForResult(UpdateNsIdFoodTransaction(pair.value))
.doOnError { error -> .doOnError { error ->
aapsLogger.error(LTag.DATABASE, "Updated ns id of Food failed", 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 { .doOnSuccess {
ret = Result.success(workDataOf("ProcessedData" to pair.toString())) ret = Result.success(workDataOf("ProcessedData" to pair.toString()))
@ -101,7 +101,7 @@ class NSClientAddAckWorker(
repository.runTransactionForResult(UpdateNsIdTherapyEventTransaction(pair.value)) repository.runTransactionForResult(UpdateNsIdTherapyEventTransaction(pair.value))
.doOnError { error -> .doOnError { error ->
aapsLogger.error(LTag.DATABASE, "Updated ns id of TherapyEvent failed", 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 { .doOnSuccess {
ret = Result.success(workDataOf("ProcessedData" to pair.toString())) ret = Result.success(workDataOf("ProcessedData" to pair.toString()))
@ -120,7 +120,7 @@ class NSClientAddAckWorker(
repository.runTransactionForResult(UpdateNsIdBolusTransaction(pair.value)) repository.runTransactionForResult(UpdateNsIdBolusTransaction(pair.value))
.doOnError { error -> .doOnError { error ->
aapsLogger.error(LTag.DATABASE, "Updated ns id of Bolus failed", 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 { .doOnSuccess {
ret = Result.success(workDataOf("ProcessedData" to pair.toString())) ret = Result.success(workDataOf("ProcessedData" to pair.toString()))
@ -139,7 +139,7 @@ class NSClientAddAckWorker(
repository.runTransactionForResult(UpdateNsIdCarbsTransaction(pair.value)) repository.runTransactionForResult(UpdateNsIdCarbsTransaction(pair.value))
.doOnError { error -> .doOnError { error ->
aapsLogger.error(LTag.DATABASE, "Updated ns id of Carbs failed", 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 { .doOnSuccess {
ret = Result.success(workDataOf("ProcessedData" to pair.toString())) ret = Result.success(workDataOf("ProcessedData" to pair.toString()))
@ -158,7 +158,7 @@ class NSClientAddAckWorker(
repository.runTransactionForResult(UpdateNsIdBolusCalculatorResultTransaction(pair.value)) repository.runTransactionForResult(UpdateNsIdBolusCalculatorResultTransaction(pair.value))
.doOnError { error -> .doOnError { error ->
aapsLogger.error(LTag.DATABASE, "Updated ns id of BolusCalculatorResult failed", 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 { .doOnSuccess {
ret = Result.success(workDataOf("ProcessedData" to pair.toString())) ret = Result.success(workDataOf("ProcessedData" to pair.toString()))
@ -177,7 +177,7 @@ class NSClientAddAckWorker(
repository.runTransactionForResult(UpdateNsIdTemporaryBasalTransaction(pair.value)) repository.runTransactionForResult(UpdateNsIdTemporaryBasalTransaction(pair.value))
.doOnError { error -> .doOnError { error ->
aapsLogger.error(LTag.DATABASE, "Updated ns id of TemporaryBasal failed", 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 { .doOnSuccess {
ret = Result.success(workDataOf("ProcessedData" to pair.toString())) ret = Result.success(workDataOf("ProcessedData" to pair.toString()))
@ -196,7 +196,7 @@ class NSClientAddAckWorker(
repository.runTransactionForResult(UpdateNsIdExtendedBolusTransaction(pair.value)) repository.runTransactionForResult(UpdateNsIdExtendedBolusTransaction(pair.value))
.doOnError { error -> .doOnError { error ->
aapsLogger.error(LTag.DATABASE, "Updated ns id of ExtendedBolus failed", 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 { .doOnSuccess {
ret = Result.success(workDataOf("ProcessedData" to pair.toString())) ret = Result.success(workDataOf("ProcessedData" to pair.toString()))
@ -215,17 +215,17 @@ class NSClientAddAckWorker(
repository.runTransactionForResult(UpdateNsIdDeviceStatusTransaction(deviceStatus)) repository.runTransactionForResult(UpdateNsIdDeviceStatusTransaction(deviceStatus))
.doOnError { error -> .doOnError { error ->
aapsLogger.error(LTag.DATABASE, "Updated ns id of DeviceStatus failed", 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 { .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") aapsLogger.debug(LTag.DATABASE, "Updated ns id of DeviceStatus $deviceStatus")
dataSyncSelector.confirmLastDeviceStatusIdIfGreater(deviceStatus.id) dataSyncSelector.confirmLastDeviceStatusIdIfGreater(deviceStatus.id)
} }
.blockingGet() .blockingGet()
rxBus.send(EventNSClientNewLog("DBADD", "Acked DeviceStatus" + deviceStatus.interfaceIDs.nightscoutId)) rxBus.send(EventNSClientNewLog("DBADD", "Acked DeviceStatus" + deviceStatus.interfaceIDs.nightscoutId))
// Send new if waiting // Send new if waiting
dataSyncSelector.processChangedBolusCalculatorResultsCompat() dataSyncSelector.processChangedDeviceStatusesCompat()
} }
} }
return ret return ret

View file

@ -79,7 +79,7 @@ class NSClientAddUpdateWorker(
repository.runTransactionForResult(SyncNsBolusTransaction(bolus, invalidateByNsOnly = false)) repository.runTransactionForResult(SyncNsBolusTransaction(bolus, invalidateByNsOnly = false))
.doOnError { .doOnError {
aapsLogger.error(LTag.DATABASE, "Error while saving bolus", it) 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() .blockingGet()
.also { result -> .also { result ->
@ -108,7 +108,7 @@ class NSClientAddUpdateWorker(
repository.runTransactionForResult(SyncNsCarbsTransaction(carb, invalidateByNsOnly = false)) repository.runTransactionForResult(SyncNsCarbsTransaction(carb, invalidateByNsOnly = false))
.doOnError { .doOnError {
aapsLogger.error(LTag.DATABASE, "Error while saving carbs", it) 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() .blockingGet()
.also { result -> .also { result ->
@ -146,7 +146,7 @@ class NSClientAddUpdateWorker(
repository.runTransactionForResult(SyncNsTemporaryTargetTransaction(temporaryTarget, invalidateByNsOnly = false)) repository.runTransactionForResult(SyncNsTemporaryTargetTransaction(temporaryTarget, invalidateByNsOnly = false))
.doOnError { .doOnError {
aapsLogger.error(LTag.DATABASE, "Error while saving temporary target", it) 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() .blockingGet()
.also { result -> .also { result ->
@ -196,7 +196,7 @@ class NSClientAddUpdateWorker(
repository.runTransactionForResult(SyncNsTherapyEventTransaction(therapyEvent, invalidateByNsOnly = false)) repository.runTransactionForResult(SyncNsTherapyEventTransaction(therapyEvent, invalidateByNsOnly = false))
.doOnError { .doOnError {
aapsLogger.error(LTag.DATABASE, "Error while saving therapy event", it) 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() .blockingGet()
.also { result -> .also { result ->
@ -231,7 +231,7 @@ class NSClientAddUpdateWorker(
repository.runTransactionForResult(SyncNsExtendedBolusTransaction(extendedBolus, invalidateByNsOnly = false)) repository.runTransactionForResult(SyncNsExtendedBolusTransaction(extendedBolus, invalidateByNsOnly = false))
.doOnError { .doOnError {
aapsLogger.error(LTag.DATABASE, "Error while saving extended bolus", it) 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() .blockingGet()
.also { result -> .also { result ->
@ -272,7 +272,7 @@ class NSClientAddUpdateWorker(
repository.runTransactionForResult(SyncNsTemporaryBasalTransaction(temporaryBasal, invalidateByNsOnly = false)) repository.runTransactionForResult(SyncNsTemporaryBasalTransaction(temporaryBasal, invalidateByNsOnly = false))
.doOnError { .doOnError {
aapsLogger.error(LTag.DATABASE, "Error while saving temporary basal", it) 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() .blockingGet()
.also { result -> .also { result ->

View file

@ -44,7 +44,7 @@ class NSClientMbgWorker(
repository.runTransactionForResult(SyncNsTherapyEventTransaction(therapyEventFromNsMbg(nsMbg), false)) repository.runTransactionForResult(SyncNsTherapyEventTransaction(therapyEventFromNsMbg(nsMbg), false))
.doOnError { .doOnError {
aapsLogger.error("Error while saving therapy event", it) aapsLogger.error("Error while saving therapy event", it)
ret = Result.failure(workDataOf("Error" to it)) ret = Result.failure(workDataOf("Error" to it.toString()))
} }
.blockingGet() .blockingGet()
.also { .also {

View file

@ -61,7 +61,7 @@ class NSClientRemoveWorker(
repository.runTransactionForResult(SyncNsTemporaryTargetTransaction(temporaryTarget, invalidateByNsOnly = true)) repository.runTransactionForResult(SyncNsTemporaryTargetTransaction(temporaryTarget, invalidateByNsOnly = true))
.doOnError { .doOnError {
aapsLogger.error(LTag.DATABASE, "Error while invalidating temporary target", it) 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() .blockingGet()
.also { result -> .also { result ->
@ -81,7 +81,7 @@ class NSClientRemoveWorker(
repository.runTransactionForResult(SyncNsTherapyEventTransaction(therapyEvent, invalidateByNsOnly = true)) repository.runTransactionForResult(SyncNsTherapyEventTransaction(therapyEvent, invalidateByNsOnly = true))
.doOnError { .doOnError {
aapsLogger.error(LTag.DATABASE, "Error while invalidating therapy event", it) 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() .blockingGet()
.also { result -> .also { result ->
@ -98,7 +98,7 @@ class NSClientRemoveWorker(
repository.runTransactionForResult(SyncNsBolusTransaction(bolus, invalidateByNsOnly = true)) repository.runTransactionForResult(SyncNsBolusTransaction(bolus, invalidateByNsOnly = true))
.doOnError { .doOnError {
aapsLogger.error(LTag.DATABASE, "Error while invalidating bolus", it) 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() .blockingGet()
.also { result -> .also { result ->
@ -114,7 +114,7 @@ class NSClientRemoveWorker(
repository.runTransactionForResult(SyncNsCarbsTransaction(carbs, invalidateByNsOnly = true)) repository.runTransactionForResult(SyncNsCarbsTransaction(carbs, invalidateByNsOnly = true))
.doOnError { .doOnError {
aapsLogger.error(LTag.DATABASE, "Error while invalidating carbs", it) 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() .blockingGet()
.also { result -> .also { result ->
@ -130,7 +130,7 @@ class NSClientRemoveWorker(
repository.runTransactionForResult(SyncNsTemporaryBasalTransaction(temporaryBasal, invalidateByNsOnly = true)) repository.runTransactionForResult(SyncNsTemporaryBasalTransaction(temporaryBasal, invalidateByNsOnly = true))
.doOnError { .doOnError {
aapsLogger.error(LTag.DATABASE, "Error while invalidating temporary basal", it) 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() .blockingGet()
.also { result -> .also { result ->
@ -146,7 +146,7 @@ class NSClientRemoveWorker(
repository.runTransactionForResult(SyncNsExtendedBolusTransaction(extendedBolus, invalidateByNsOnly = true)) repository.runTransactionForResult(SyncNsExtendedBolusTransaction(extendedBolus, invalidateByNsOnly = true))
.doOnError { .doOnError {
aapsLogger.error(LTag.DATABASE, "Error while invalidating extended bolus", it) 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() .blockingGet()
.also { result -> .also { result ->

View file

@ -144,7 +144,7 @@ class DexcomPlugin @Inject constructor(
repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, calibrations, sensorStartTime)) repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, calibrations, sensorStartTime))
.doOnError { .doOnError {
aapsLogger.error(LTag.DATABASE, "Error while saving values from Dexcom App", it) 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() .blockingGet()
.also { result -> .also { result ->
@ -173,7 +173,7 @@ class DexcomPlugin @Inject constructor(
} }
} catch (e: Exception) { } catch (e: Exception) {
aapsLogger.error("Error while processing intent from Dexcom App", e) 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 return ret
} }

View file

@ -112,7 +112,7 @@ class EversensePlugin @Inject constructor(
repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, emptyList(), null)) repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, emptyList(), null))
.doOnError { .doOnError {
aapsLogger.error(LTag.DATABASE, "Error while saving values from Eversense App", it) 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() .blockingGet()
.also { savedValues -> .also { savedValues ->
@ -142,7 +142,7 @@ class EversensePlugin @Inject constructor(
)) ))
.doOnError { .doOnError {
aapsLogger.error(LTag.DATABASE, "Error while saving therapy event", it) 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() .blockingGet()
.also { result -> .also { result ->

View file

@ -70,7 +70,7 @@ class GlimpPlugin @Inject constructor(
repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, emptyList(), null)) repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, emptyList(), null))
.doOnError { .doOnError {
aapsLogger.error(LTag.DATABASE, "Error while saving values from Glimp App", it) 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() .blockingGet()
.also { savedValues -> .also { savedValues ->

View file

@ -88,7 +88,7 @@ class MM640gPlugin @Inject constructor(
repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, emptyList(), null)) repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, emptyList(), null))
.doOnError { .doOnError {
aapsLogger.error(LTag.DATABASE, "Error while saving values from Eversense App", it) 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() .blockingGet()
.also { savedValues -> .also { savedValues ->
@ -99,7 +99,7 @@ class MM640gPlugin @Inject constructor(
} }
} catch (e: JSONException) { } catch (e: JSONException) {
aapsLogger.error("Exception: ", e) aapsLogger.error("Exception: ", e)
ret = Result.failure(workDataOf("Error" to e)) ret = Result.failure(workDataOf("Error" to e.toString()))
} }
} }
} }

View file

@ -142,7 +142,7 @@ class NSClientSourcePlugin @Inject constructor(
repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, emptyList(), null, !nsClientSourcePlugin.isEnabled())) repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, emptyList(), null, !nsClientSourcePlugin.isEnabled()))
.doOnError { .doOnError {
aapsLogger.error(LTag.DATABASE, "Error while saving values from NSClient App", it) 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() .blockingGet()
.also { result -> .also { result ->
@ -159,7 +159,7 @@ class NSClientSourcePlugin @Inject constructor(
} }
} catch (e: Exception) { } catch (e: Exception) {
aapsLogger.error("Unhandled exception", e) aapsLogger.error("Unhandled exception", e)
ret = Result.failure(workDataOf("Error" to e)) ret = Result.failure(workDataOf("Error" to e.toString()))
} }
// Objectives 0 // Objectives 0
sp.putBoolean(R.string.key_ObjectivesbgIsAvailableInNS, true) sp.putBoolean(R.string.key_ObjectivesbgIsAvailableInNS, true)

View file

@ -81,7 +81,7 @@ class PoctechPlugin @Inject constructor(
repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, emptyList(), null)) repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, emptyList(), null))
.doOnError { .doOnError {
aapsLogger.error(LTag.DATABASE, "Error while saving values from Poctech App", it) 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() .blockingGet()
.also { savedValues -> .also { savedValues ->
@ -92,7 +92,7 @@ class PoctechPlugin @Inject constructor(
} }
} catch (e: JSONException) { } catch (e: JSONException) {
aapsLogger.error("Exception: ", e) aapsLogger.error("Exception: ", e)
ret = Result.failure(workDataOf("Error" to e)) ret = Result.failure(workDataOf("Error" to e.toString()))
} }
return ret return ret
} }

View file

@ -72,7 +72,7 @@ class TomatoPlugin @Inject constructor(
repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, emptyList(), null)) repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, emptyList(), null))
.doOnError { .doOnError {
aapsLogger.error(LTag.DATABASE, "Error while saving values from Tomato App", it) 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() .blockingGet()
.also { savedValues -> .also { savedValues ->

View file

@ -91,7 +91,7 @@ class XdripPlugin @Inject constructor(
repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, emptyList(), null)) repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, emptyList(), null))
.doOnError { .doOnError {
aapsLogger.error(LTag.DATABASE, "Error while saving values from Xdrip", it) 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() .blockingGet()
.also { savedValues -> .also { savedValues ->

View file

@ -32,10 +32,10 @@ internal interface DeviceStatusDao {
fun findByNSId(nsId: String): DeviceStatus? fun findByNSId(nsId: String): DeviceStatus?
// This query will be used with v3 to get all changed records // 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<List<DeviceStatus>> fun getModifiedFrom(id: Long): Single<List<DeviceStatus>>
// for WS we need 1 record only // 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<DeviceStatus> fun getNextModifiedOrNewAfter(id: Long): Maybe<DeviceStatus>
} }