fix adding basals to database in danar driver
This commit is contained in:
parent
74268675af
commit
96d760ba62
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue