fix storing carbs
This commit is contained in:
parent
7cf4db5fcc
commit
2a2bb4edc6
1 changed files with 2 additions and 0 deletions
|
@ -223,12 +223,14 @@ class CommandQueueImplementation @Inject constructor(
|
||||||
// Assuming carbs in the future and carbs with duration are NOT stores anyway
|
// Assuming carbs in the future and carbs with duration are NOT stores anyway
|
||||||
|
|
||||||
var carbsRunnable = Runnable { }
|
var carbsRunnable = Runnable { }
|
||||||
|
val originalCarbs = detailedBolusInfo.carbs
|
||||||
if ((detailedBolusInfo.carbs > 0) &&
|
if ((detailedBolusInfo.carbs > 0) &&
|
||||||
(!activePlugin.activePump.pumpDescription.storesCarbInfo ||
|
(!activePlugin.activePump.pumpDescription.storesCarbInfo ||
|
||||||
detailedBolusInfo.carbsDuration != 0L ||
|
detailedBolusInfo.carbsDuration != 0L ||
|
||||||
(detailedBolusInfo.carbsTimestamp ?: detailedBolusInfo.timestamp) > dateUtil.now())
|
(detailedBolusInfo.carbsTimestamp ?: detailedBolusInfo.timestamp) > dateUtil.now())
|
||||||
) {
|
) {
|
||||||
carbsRunnable = Runnable {
|
carbsRunnable = Runnable {
|
||||||
|
detailedBolusInfo.carbs = originalCarbs
|
||||||
disposable += repository.runTransactionForResult(detailedBolusInfo.insertCarbsTransaction())
|
disposable += repository.runTransactionForResult(detailedBolusInfo.insertCarbsTransaction())
|
||||||
.subscribeBy(
|
.subscribeBy(
|
||||||
onSuccess = { result ->
|
onSuccess = { result ->
|
||||||
|
|
Loading…
Reference in a new issue