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
|
||||
|
||||
var carbsRunnable = Runnable { }
|
||||
val originalCarbs = detailedBolusInfo.carbs
|
||||
if ((detailedBolusInfo.carbs > 0) &&
|
||||
(!activePlugin.activePump.pumpDescription.storesCarbInfo ||
|
||||
detailedBolusInfo.carbsDuration != 0L ||
|
||||
(detailedBolusInfo.carbsTimestamp ?: detailedBolusInfo.timestamp) > dateUtil.now())
|
||||
) {
|
||||
carbsRunnable = Runnable {
|
||||
detailedBolusInfo.carbs = originalCarbs
|
||||
disposable += repository.runTransactionForResult(detailedBolusInfo.insertCarbsTransaction())
|
||||
.subscribeBy(
|
||||
onSuccess = { result ->
|
||||
|
|
Loading…
Reference in a new issue