improve calculation workflow behavior
This commit is contained in:
parent
551af710b6
commit
6ebec7935d
|
@ -198,23 +198,23 @@ class CalculationWorkflowImpl @Inject constructor(
|
|||
.build()
|
||||
)
|
||||
.then(
|
||||
job == MAIN_CALCULATION,
|
||||
runIf = job == MAIN_CALCULATION,
|
||||
OneTimeWorkRequest.Builder(UpdateGraphWorker::class.java)
|
||||
.setInputData(Data.Builder().putString(JOB, job).putInt(PASS, CalculationWorkflow.ProgressData.DRAW_IOB.pass).build())
|
||||
.build()
|
||||
)
|
||||
.then(
|
||||
job == MAIN_CALCULATION,
|
||||
runIf = job == MAIN_CALCULATION,
|
||||
OneTimeWorkRequest.Builder(InvokeLoopWorker::class.java)
|
||||
.setInputData(dataWorkerStorage.storeInputData(InvokeLoopWorker.InvokeLoopData(cause)))
|
||||
.build()
|
||||
)
|
||||
.then(
|
||||
job == MAIN_CALCULATION,
|
||||
runIf = job == MAIN_CALCULATION,
|
||||
OneTimeWorkRequest.Builder(UpdateWidgetWorker::class.java).build()
|
||||
)
|
||||
.then(
|
||||
job == MAIN_CALCULATION,
|
||||
runIf = job == MAIN_CALCULATION,
|
||||
OneTimeWorkRequest.Builder(PreparePredictionsWorker::class.java)
|
||||
.setInputData(dataWorkerStorage.storeInputData(PreparePredictionsWorker.PreparePredictionsData(overviewData)))
|
||||
.build()
|
||||
|
|
|
@ -57,6 +57,7 @@ class PrepareBasalDataWorker(
|
|||
val fromTime = data.overviewData.fromTime
|
||||
var time = fromTime
|
||||
while (time < endTime) {
|
||||
if (isStopped) return Result.failure(workDataOf("Error" to "stopped"))
|
||||
val progress = (time - fromTime).toDouble() / (endTime - fromTime) * 100.0
|
||||
rxBus.send(EventIobCalculationProgress(CalculationWorkflow.ProgressData.PREPARE_BASAL_DATA, progress.toInt(), null))
|
||||
val profile = profileFunction.getProfile(time)
|
||||
|
|
|
@ -158,6 +158,7 @@ class PrepareIobAutosensGraphDataWorker(
|
|||
val adsData = data.iobCobCalculator.ads.clone()
|
||||
|
||||
while (time <= endTime) {
|
||||
if (isStopped) return Result.failure(workDataOf("Error" to "stopped"))
|
||||
val progress = (time - fromTime).toDouble() / (endTime - fromTime) * 100.0
|
||||
rxBus.send(EventIobCalculationProgress(CalculationWorkflow.ProgressData.PREPARE_IOB_AUTOSENS_DATA, progress.toInt(), null))
|
||||
val profile = profileFunction.getProfile(time)
|
||||
|
|
|
@ -58,6 +58,7 @@ class PrepareTemporaryTargetDataWorker(
|
|||
loop.lastRun?.constraintsProcessed?.let { endTime = max(it.latestPredictionsTime, endTime) }
|
||||
var time = fromTime
|
||||
while (time < endTime) {
|
||||
if (isStopped) return Result.failure(workDataOf("Error" to "stopped"))
|
||||
val progress = (time - fromTime).toDouble() / (endTime - fromTime) * 100.0
|
||||
rxBus.send(EventIobCalculationProgress(CalculationWorkflow.ProgressData.PREPARE_TEMPORARY_TARGET_DATA, progress.toInt(), null))
|
||||
val tt = repository.getTemporaryTargetActiveAt(time).blockingGet()
|
||||
|
|
Loading…
Reference in a new issue