From 1f1a2eae48564779a9f88363749f6d58fa8441f1 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sun, 4 Dec 2022 20:20:53 +0100 Subject: [PATCH] show full activity prediction --- .../nightscout/workflow/PrepareBasalDataWorker.kt | 12 ++++++------ .../workflow/PrepareIobAutosensGraphDataWorker.kt | 4 ++-- .../workflow/PrepareTemporaryTargetDataWorker.kt | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/workflow/src/main/java/info/nightscout/workflow/PrepareBasalDataWorker.kt b/workflow/src/main/java/info/nightscout/workflow/PrepareBasalDataWorker.kt index 2d4deb16dc..e0c19c5704 100644 --- a/workflow/src/main/java/info/nightscout/workflow/PrepareBasalDataWorker.kt +++ b/workflow/src/main/java/info/nightscout/workflow/PrepareBasalDataWorker.kt @@ -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 { diff --git a/workflow/src/main/java/info/nightscout/workflow/PrepareIobAutosensGraphDataWorker.kt b/workflow/src/main/java/info/nightscout/workflow/PrepareIobAutosensGraphDataWorker.kt index dfe9b26daa..40bb033065 100644 --- a/workflow/src/main/java/info/nightscout/workflow/PrepareIobAutosensGraphDataWorker.kt +++ b/workflow/src/main/java/info/nightscout/workflow/PrepareIobAutosensGraphDataWorker.kt @@ -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) { diff --git a/workflow/src/main/java/info/nightscout/workflow/PrepareTemporaryTargetDataWorker.kt b/workflow/src/main/java/info/nightscout/workflow/PrepareTemporaryTargetDataWorker.kt index 107a063ad4..025e4943ed 100644 --- a/workflow/src/main/java/info/nightscout/workflow/PrepareTemporaryTargetDataWorker.kt +++ b/workflow/src/main/java/info/nightscout/workflow/PrepareTemporaryTargetDataWorker.kt @@ -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 = ArrayList() var lastTarget = -1.0 loop.lastRun?.constraintsProcessed?.let { toTime = max(it.latestPredictionsTime, toTime) }