diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgStatusBolusExtended.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgStatusBolusExtended.java index 4e17bdb4bb..9d9ccde307 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgStatusBolusExtended.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgStatusBolusExtended.java @@ -74,14 +74,15 @@ public class MsgStatusBolusExtended extends MessageBase { if (pump.isExtendedInProgress) { if (extendedBolus.absoluteRate() != pump.extendedBolusAbsoluteRate) { // Close current extended - ExtendedBolus exStop = new ExtendedBolus(now - 1000); + ExtendedBolus exStop = new ExtendedBolus(pump.extendedBolusStart.getTime() - 1000); exStop.source = Source.USER; treatmentsInterface.addToHistoryExtendedBolus(exStop); // Create new ExtendedBolus newExtended = new ExtendedBolus(); - newExtended.date = new Date(now).getTime(); + newExtended.date = pump.extendedBolusStart.getTime(); newExtended.insulin = pump.extendedBolusAmount; newExtended.durationInMinutes = pump.extendedBolusMinutes; + newExtended.source = Source.USER; treatmentsInterface.addToHistoryExtendedBolus(newExtended); } } else { @@ -94,9 +95,10 @@ public class MsgStatusBolusExtended extends MessageBase { if (pump.isExtendedInProgress) { // Create new ExtendedBolus newExtended = new ExtendedBolus(); - newExtended.date = new Date(now).getTime(); + newExtended.date = pump.extendedBolusStart.getTime(); newExtended.insulin = pump.extendedBolusAmount; newExtended.durationInMinutes = pump.extendedBolusMinutes; + newExtended.source = Source.USER; treatmentsInterface.addToHistoryExtendedBolus(newExtended); } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgStatusTempBasal.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgStatusTempBasal.java index e9f7148423..bcfd56a8fe 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgStatusTempBasal.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgStatusTempBasal.java @@ -68,12 +68,12 @@ public class MsgStatusTempBasal extends MessageBase { if (danaRPump.isTempBasalInProgress) { if (tempBasal.percentRate != danaRPump.tempBasalPercent) { // Close current temp basal - TemporaryBasal tempStop = new TemporaryBasal(now - 1000); + TemporaryBasal tempStop = new TemporaryBasal(danaRPump.tempBasalStart.getTime() - 1000); tempStop.source = Source.USER; treatmentsInterface.addToHistoryTempBasal(tempStop); // Create new TemporaryBasal newTempBasal = new TemporaryBasal(); - newTempBasal.date = new Date(now).getTime(); + newTempBasal.date = danaRPump.tempBasalStart.getTime(); newTempBasal.percentRate = danaRPump.tempBasalPercent; newTempBasal.isAbsolute = false; newTempBasal.durationInMinutes = danaRPump.tempBasalTotalSec / 60; @@ -90,7 +90,7 @@ public class MsgStatusTempBasal extends MessageBase { if (danaRPump.isTempBasalInProgress) { // Create new TemporaryBasal newTempBasal = new TemporaryBasal(); - newTempBasal.date = new Date(now).getTime(); + newTempBasal.date = danaRPump.tempBasalStart.getTime(); newTempBasal.percentRate = danaRPump.tempBasalPercent; newTempBasal.isAbsolute = false; newTempBasal.durationInMinutes = danaRPump.tempBasalTotalSec / 60;