fix adding contribution from faked extended
This commit is contained in:
parent
a9b251ce12
commit
4b39578d9c
3 changed files with 14 additions and 3 deletions
|
@ -22,6 +22,8 @@ public class IobTotal {
|
||||||
public Double netInsulin = 0d; // for calculations from temp basals only
|
public Double netInsulin = 0d; // for calculations from temp basals only
|
||||||
public Double netRatio = 0d; // net ratio at start of temp basal
|
public Double netRatio = 0d; // net ratio at start of temp basal
|
||||||
|
|
||||||
|
public Double extendedBolusInsulin = 0d; // total insulin for extended bolus
|
||||||
|
|
||||||
long time;
|
long time;
|
||||||
|
|
||||||
public IobTotal(long time) {
|
public IobTotal(long time) {
|
||||||
|
@ -42,7 +44,7 @@ public class IobTotal {
|
||||||
netbasalinsulin += other.netbasalinsulin;
|
netbasalinsulin += other.netbasalinsulin;
|
||||||
hightempinsulin += other.hightempinsulin;
|
hightempinsulin += other.hightempinsulin;
|
||||||
netInsulin += other.netInsulin;
|
netInsulin += other.netInsulin;
|
||||||
netRatio += other.netRatio;
|
extendedBolusInsulin += other.extendedBolusInsulin;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -159,6 +159,7 @@ public class ExtendedBolus implements Interval {
|
||||||
Iob aIOB = insulinInterface.iobCalcForTreatment(tempBolusPart, time, profile.getDia());
|
Iob aIOB = insulinInterface.iobCalcForTreatment(tempBolusPart, time, profile.getDia());
|
||||||
result.iob += aIOB.iobContrib;
|
result.iob += aIOB.iobContrib;
|
||||||
result.activity += aIOB.activityContrib;
|
result.activity += aIOB.activityContrib;
|
||||||
|
result.extendedBolusInsulin += tempBolusPart.insulin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -306,13 +306,21 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
||||||
//log.debug("BasalIOB " + new Date(time) + " >>> " + calc.basaliob);
|
//log.debug("BasalIOB " + new Date(time) + " >>> " + calc.basaliob);
|
||||||
total.plus(calc);
|
total.plus(calc);
|
||||||
}
|
}
|
||||||
if (MainApp.getConfigBuilder().isFakingTempsByExtendedBoluses())
|
if (MainApp.getConfigBuilder().isFakingTempsByExtendedBoluses()) {
|
||||||
|
IobTotal totalExt = new IobTotal(time);
|
||||||
for (Integer pos = 0; pos < extendedBoluses.size(); pos++) {
|
for (Integer pos = 0; pos < extendedBoluses.size(); pos++) {
|
||||||
ExtendedBolus e = extendedBoluses.get(pos);
|
ExtendedBolus e = extendedBoluses.get(pos);
|
||||||
if (e.date > time) continue;
|
if (e.date > time) continue;
|
||||||
IobTotal calc = e.iobCalc(time);
|
IobTotal calc = e.iobCalc(time);
|
||||||
total.plus(calc);
|
totalExt.plus(calc);
|
||||||
}
|
}
|
||||||
|
// Convert to basal iob
|
||||||
|
totalExt.basaliob = totalExt.iob;
|
||||||
|
totalExt.iob = 0d;
|
||||||
|
totalExt.netbasalinsulin = totalExt.extendedBolusInsulin;
|
||||||
|
totalExt.hightempinsulin = totalExt.extendedBolusInsulin;
|
||||||
|
total.plus(totalExt);
|
||||||
|
}
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue