fix Stats
This commit is contained in:
parent
d165e02044
commit
edd5dd7980
|
@ -62,7 +62,7 @@ class TddCalculator @Inject constructor(
|
||||||
val midnight = MidnightTime.calc(t)
|
val midnight = MidnightTime.calc(t)
|
||||||
val tdd = result[midnight] ?: TDD(midnight, 0.0, 0.0, 0.0)
|
val tdd = result[midnight] ?: TDD(midnight, 0.0, 0.0, 0.0)
|
||||||
val tbr = getTempBasalFromHistory(t)
|
val tbr = getTempBasalFromHistory(t)
|
||||||
val profile = profileFunction.getProfile(t) ?: continue
|
val profile = profileFunction.getProfile(t, this) ?: continue
|
||||||
val absoluteRate = tbr?.tempBasalConvertedToAbsolute(t, profile) ?: profile.getBasal(t)
|
val absoluteRate = tbr?.tempBasalConvertedToAbsolute(t, profile) ?: profile.getBasal(t)
|
||||||
tdd.basal += absoluteRate / 60.0 * 5.0
|
tdd.basal += absoluteRate / 60.0 * 5.0
|
||||||
|
|
||||||
|
|
|
@ -13,5 +13,6 @@ interface ProfileFunction {
|
||||||
fun getProfile(): Profile?
|
fun getProfile(): Profile?
|
||||||
fun getUnits(): String
|
fun getUnits(): String
|
||||||
fun getProfile(time: Long): Profile?
|
fun getProfile(time: Long): Profile?
|
||||||
|
fun getProfile(time: Long, activeTreatments: TreatmentsInterface): Profile?
|
||||||
fun prepareProfileSwitch(profileStore: ProfileStore, profileName: String, duration: Int, percentage: Int, timeShift: Int, date: Long): ProfileSwitch
|
fun prepareProfileSwitch(profileStore: ProfileStore, profileName: String, duration: Int, percentage: Int, timeShift: Int, date: Long): ProfileSwitch
|
||||||
}
|
}
|
|
@ -11,6 +11,7 @@ import info.nightscout.androidaps.db.Source
|
||||||
import info.nightscout.androidaps.interfaces.ProfileStore
|
import info.nightscout.androidaps.interfaces.ProfileStore
|
||||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
|
import info.nightscout.androidaps.interfaces.TreatmentsInterface
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger
|
import info.nightscout.androidaps.logging.AAPSLogger
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
|
@ -70,8 +71,9 @@ class ProfileFunctionImplementation @Inject constructor(
|
||||||
override fun getProfile(): Profile? =
|
override fun getProfile(): Profile? =
|
||||||
getProfile(System.currentTimeMillis())
|
getProfile(System.currentTimeMillis())
|
||||||
|
|
||||||
override fun getProfile(time: Long): Profile? {
|
override fun getProfile(time: Long): Profile? = getProfile(time, activePlugin.activeTreatments)
|
||||||
val activeTreatments = activePlugin.activeTreatments
|
|
||||||
|
override fun getProfile(time: Long, activeTreatments: TreatmentsInterface): Profile? {
|
||||||
val activeProfile = activePlugin.activeProfileInterface
|
val activeProfile = activePlugin.activeProfileInterface
|
||||||
|
|
||||||
//log.debug("Profile for: " + new Date(time).toLocaleString() + " : " + getProfileName(time));
|
//log.debug("Profile for: " + new Date(time).toLocaleString() + " : " + getProfileName(time));
|
||||||
|
|
Loading…
Reference in a new issue