Combo: allow records created by the combo to be merged with existing records.
This commit is contained in:
parent
817a89c39b
commit
34182b81a1
1 changed files with 2 additions and 11 deletions
|
@ -665,15 +665,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
||||||
dbi.source = Source.PUMP;
|
dbi.source = Source.PUMP;
|
||||||
dbi.insulin = lastPumpBolus.amount;
|
dbi.insulin = lastPumpBolus.amount;
|
||||||
try {
|
try {
|
||||||
boolean treatmentCreated = TreatmentsPlugin.getPlugin().addToHistoryTreatment(dbi, false);
|
TreatmentsPlugin.getPlugin().addToHistoryTreatment(dbi, true);
|
||||||
if (!treatmentCreated) {
|
|
||||||
log.error("Adding treatment record overrode an existing record: " + dbi);
|
|
||||||
if (dbi.isSMB) {
|
|
||||||
Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, MainApp.gs(R.string.combo_error_updating_treatment_record), Notification.URGENT);
|
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Adding treatment record failed", e);
|
log.error("Adding treatment record failed", e);
|
||||||
if (dbi.isSMB) {
|
if (dbi.isSMB) {
|
||||||
|
@ -1158,8 +1150,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
||||||
dbi.source = Source.PUMP;
|
dbi.source = Source.PUMP;
|
||||||
dbi.insulin = pumpBolus.amount;
|
dbi.insulin = pumpBolus.amount;
|
||||||
dbi.eventType = CareportalEvent.CORRECTIONBOLUS;
|
dbi.eventType = CareportalEvent.CORRECTIONBOLUS;
|
||||||
if (TreatmentsPlugin.getPlugin().getService().getPumpRecordById(dbi.pumpId) == null) {
|
if (TreatmentsPlugin.getPlugin().addToHistoryTreatment(dbi, true)) {
|
||||||
TreatmentsPlugin.getPlugin().addToHistoryTreatment(dbi, false);
|
|
||||||
updated = true;
|
updated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue