Fix ExtendedBolus and EmulatingTempBasal
This commit is contained in:
parent
17d7464239
commit
f22c8ca642
|
@ -138,23 +138,17 @@ open class AutotuneIob @Inject constructor(
|
||||||
//nsTreatment is used only for export data
|
//nsTreatment is used only for export data
|
||||||
private fun initializeExtendedBolusData(from: Long, to: Long, tunedProfile: ATProfile) {
|
private fun initializeExtendedBolusData(from: Long, to: Long, tunedProfile: ATProfile) {
|
||||||
val extendedBoluses = repository.getExtendedBolusDataFromTimeToTime(from, to, false).blockingGet()
|
val extendedBoluses = repository.getExtendedBolusDataFromTimeToTime(from, to, false).blockingGet()
|
||||||
val pumpInterface = activePlugin.activePump
|
for (i in extendedBoluses.indices) {
|
||||||
if (pumpInterface.isFakingTempsByExtendedBoluses) {
|
val eb = extendedBoluses[i]
|
||||||
for (i in extendedBoluses.indices) {
|
if (eb.isValid)
|
||||||
val eb = extendedBoluses[i]
|
if (eb.isEmulatingTempBasal) {
|
||||||
if (eb.isValid)
|
|
||||||
profileFunction.getProfile(eb.timestamp)?.let {
|
profileFunction.getProfile(eb.timestamp)?.let {
|
||||||
toSplittedTimestampTB(eb.toTemporaryBasal(it), tunedProfile)
|
toSplittedTimestampTB(eb.toTemporaryBasal(it), tunedProfile)
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
} else {
|
|
||||||
for (i in extendedBoluses.indices) {
|
|
||||||
val eb = extendedBoluses[i]
|
|
||||||
if (eb.isValid) {
|
|
||||||
nsTreatments.add(NsTreatment(eb))
|
nsTreatments.add(NsTreatment(eb))
|
||||||
boluses.addAll(convertToBoluses(eb))
|
boluses.addAll(convertToBoluses(eb))
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue