Merge pull request #380 from MilosKozak/dia-divisor-fix
Dia divisor / bolussnooze fix
This commit is contained in:
commit
33cf707d45
|
@ -183,10 +183,8 @@ public class Treatment implements DataPointWithLabelInterface {
|
|||
public Iob iobCalc(long time, double dia) {
|
||||
if (!isValid)
|
||||
return new Iob();
|
||||
InsulinInterface insulinInterface = MainApp.getInsulinIterfaceById(insulinInterfaceID);
|
||||
if (insulinInterface == null)
|
||||
insulinInterface = ConfigBuilderPlugin.getActiveInsulin();
|
||||
|
||||
InsulinInterface insulinInterface = ConfigBuilderPlugin.getActiveInsulin();
|
||||
return insulinInterface.iobCalcForTreatment(this, time, dia);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -185,7 +185,11 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
|||
total.iob += tIOB.iobContrib;
|
||||
total.activity += tIOB.activityContrib;
|
||||
if (!t.isSMB) {
|
||||
Iob bIOB = t.iobCalc(time, dia / SP.getDouble("openapsama_bolussnooze_dia_divisor", 2.0));
|
||||
// instead of dividing the DIA that only worked on the bilinear curves,
|
||||
// multiply the time the treatment is seen active.
|
||||
long timeSinceTreatment = time - t.date;
|
||||
long snoozeTime = t.date + (long)(timeSinceTreatment * SP.getDouble("openapsama_bolussnooze_dia_divisor", 2.0));
|
||||
Iob bIOB = t.iobCalc(snoozeTime, dia);
|
||||
total.bolussnooze += bIOB.iobContrib;
|
||||
} else {
|
||||
total.basaliob += t.insulin;
|
||||
|
|
Loading…
Reference in a new issue