Use of calculation step reverted back to value / 60 * 5, as calculation step method was producing incorrect, very large numbers.

This commit is contained in:
t_j_s 2022-02-20 15:58:06 +00:00
parent 58d9ce78d7
commit 035e9742af

View file

@ -103,13 +103,13 @@ class TddCalculator @Inject constructor(
val tbr = iobCobCalculator.getTempBasalIncludingConvertedExtended(t) val tbr = iobCobCalculator.getTempBasalIncludingConvertedExtended(t)
val profile = profileFunction.getProfile(t) ?: continue val profile = profileFunction.getProfile(t) ?: continue
val absoluteRate = tbr?.convertedToAbsolute(t, profile) ?: profile.getBasal(t) val absoluteRate = tbr?.convertedToAbsolute(t, profile) ?: profile.getBasal(t)
tdd.basalAmount += absoluteRate / T.mins(5).msecs().toDouble() * calculationStep.toDouble() tdd.basalAmount += absoluteRate / 60.0 * 5.0
if (!activePlugin.activePump.isFakingTempsByExtendedBoluses) { if (!activePlugin.activePump.isFakingTempsByExtendedBoluses) {
// they are not included in TBRs // they are not included in TBRs
val eb = iobCobCalculator.getExtendedBolus(t) val eb = iobCobCalculator.getExtendedBolus(t)
val absoluteEbRate = eb?.rate ?: 0.0 val absoluteEbRate = eb?.rate ?: 0.0
tdd.bolusAmount += absoluteEbRate / T.mins(5).msecs().toDouble() * calculationStep.toDouble() tdd.bolusAmount += absoluteEbRate / 60.0 * 5.0
} }
//result.put(midnight, tdd) //result.put(midnight, tdd)
} }
@ -150,13 +150,13 @@ class TddCalculator @Inject constructor(
val tbr = iobCobCalculator.getTempBasalIncludingConvertedExtended(t) val tbr = iobCobCalculator.getTempBasalIncludingConvertedExtended(t)
val profile = profileFunction.getProfile(t) ?: continue val profile = profileFunction.getProfile(t) ?: continue
val absoluteRate = tbr?.convertedToAbsolute(t, profile) ?: profile.getBasal(t) val absoluteRate = tbr?.convertedToAbsolute(t, profile) ?: profile.getBasal(t)
tdd.basalAmount += absoluteRate / T.mins(5).msecs().toDouble() * calculationStep.toDouble() tdd.basalAmount += absoluteRate / 60.0 * 5.0
if (!activePlugin.activePump.isFakingTempsByExtendedBoluses) { if (!activePlugin.activePump.isFakingTempsByExtendedBoluses) {
// they are not included in TBRs // they are not included in TBRs
val eb = iobCobCalculator.getExtendedBolus(t) val eb = iobCobCalculator.getExtendedBolus(t)
val absoluteEbRate = eb?.rate ?: 0.0 val absoluteEbRate = eb?.rate ?: 0.0
tdd.bolusAmount += absoluteEbRate / T.mins(5).msecs().toDouble() * calculationStep.toDouble() tdd.bolusAmount += absoluteEbRate / 60.0 * 5.0
} }
//result.put(midnight, tdd) //result.put(midnight, tdd)
} }