show full activity prediction

This commit is contained in:
Milos Kozak 2022-12-04 20:20:53 +01:00
parent bd35007f44
commit 1f1a2eae48
3 changed files with 9 additions and 9 deletions

View file

@ -52,8 +52,8 @@ class PrepareBasalDataWorker(
var lastBaseBasal = 0.0
var lastTempBasal = 0.0
var time = data.overviewData.fromTime
while (time < data.overviewData.toTime) {
val progress = (time - data.overviewData.fromTime).toDouble() / (data.overviewData.toTime - data.overviewData.fromTime) * 100.0
while (time < data.overviewData.endTime) {
val progress = (time - data.overviewData.endTime).toDouble() / (data.overviewData.endTime - data.overviewData.fromTime) * 100.0
rxBus.send(EventIobCalculationProgress(CalculationWorkflow.ProgressData.PREPARE_BASAL_DATA, progress.toInt(), null))
val profile = profileFunction.getProfile(time)
if (profile == null) {
@ -103,10 +103,10 @@ class PrepareBasalDataWorker(
}
// final points
basalLineArray.add(ScaledDataPoint(data.overviewData.toTime, lastLineBasal, data.overviewData.basalScale))
baseBasalArray.add(ScaledDataPoint(data.overviewData.toTime, lastBaseBasal, data.overviewData.basalScale))
tempBasalArray.add(ScaledDataPoint(data.overviewData.toTime, lastTempBasal, data.overviewData.basalScale))
absoluteBasalLineArray.add(ScaledDataPoint(data.overviewData.toTime, lastAbsoluteLineBasal, data.overviewData.basalScale))
basalLineArray.add(ScaledDataPoint(data.overviewData.endTime, lastLineBasal, data.overviewData.basalScale))
baseBasalArray.add(ScaledDataPoint(data.overviewData.endTime, lastBaseBasal, data.overviewData.basalScale))
tempBasalArray.add(ScaledDataPoint(data.overviewData.endTime, lastTempBasal, data.overviewData.basalScale))
absoluteBasalLineArray.add(ScaledDataPoint(data.overviewData.endTime, lastAbsoluteLineBasal, data.overviewData.basalScale))
// create series
data.overviewData.baseBasalGraphSeries = LineGraphSeries(Array(baseBasalArray.size) { i -> baseBasalArray[i] }).also {

View file

@ -151,8 +151,8 @@ class PrepareIobAutosensGraphDataWorker(
val adsData = data.iobCobCalculator.ads.clone()
while (time <= data.overviewData.toTime) {
val progress = (time - data.overviewData.fromTime).toDouble() / (data.overviewData.toTime - data.overviewData.fromTime) * 100.0
while (time <= data.overviewData.endTime) {
val progress = (time - data.overviewData.endTime).toDouble() / (data.overviewData.endTime - data.overviewData.fromTime) * 100.0
rxBus.send(EventIobCalculationProgress(CalculationWorkflow.ProgressData.PREPARE_IOB_AUTOSENS_DATA, progress.toInt(), null))
val profile = profileFunction.getProfile(time)
if (profile == null) {

View file

@ -49,7 +49,7 @@ class PrepareTemporaryTargetDataWorker(
rxBus.send(EventIobCalculationProgress(CalculationWorkflow.ProgressData.PREPARE_TEMPORARY_TARGET_DATA, 0, null))
val profile = profileFunction.getProfile() ?: return Result.success(workDataOf("Error" to "missing profile"))
val units = profileFunction.getUnits()
var toTime = data.overviewData.toTime
var toTime = data.overviewData.endTime
val targetsSeriesArray: MutableList<DataPoint> = ArrayList()
var lastTarget = -1.0
loop.lastRun?.constraintsProcessed?.let { toTime = max(it.latestPredictionsTime, toTime) }