better EVENT logging

This commit is contained in:
Milos Kozak 2023-08-16 12:14:15 +02:00
parent eb99dbb362
commit 551af710b6
3 changed files with 9 additions and 3 deletions

View file

@ -167,7 +167,7 @@ class HistoryBrowseActivity : TranslatedDaggerAppCompatActivity() {
disposable += rxBus disposable += rxBus
.toObservable(EventIobCalculationProgress::class.java) .toObservable(EventIobCalculationProgress::class.java)
.observeOn(aapsSchedulers.main) .observeOn(aapsSchedulers.main)
.subscribe({ updateCalcProgress(it.pass.finalPercent(it.progressPct)) }, fabricPrivacy::logException) .subscribe({ updateCalcProgress(it.finalPercent) }, fabricPrivacy::logException)
disposable += rxBus disposable += rxBus
.toObservable(EventUpdateOverviewGraph::class.java) .toObservable(EventUpdateOverviewGraph::class.java)
.observeOn(aapsSchedulers.main) .observeOn(aapsSchedulers.main)

View file

@ -3,4 +3,10 @@ package info.nightscout.core.events
import info.nightscout.core.workflow.CalculationWorkflow import info.nightscout.core.workflow.CalculationWorkflow
import info.nightscout.rx.events.Event import info.nightscout.rx.events.Event
class EventIobCalculationProgress(val pass: CalculationWorkflow.ProgressData, val progressPct: Int, val cause: Event?) : Event() class EventIobCalculationProgress(val pass: CalculationWorkflow.ProgressData, private val progressPct: Int, val cause: Event?) : Event() {
override fun toString(): String =
"EventIobCalculationProgress[cause=$cause,pass=$pass,progressPct=$progressPct,finalPercent=$finalPercent]"
val finalPercent get() = pass.finalPercent(progressPct)
}

View file

@ -122,7 +122,7 @@ class OverviewPlugin @Inject constructor(
.toObservable(EventIobCalculationProgress::class.java) .toObservable(EventIobCalculationProgress::class.java)
.observeOn(aapsSchedulers.io) .observeOn(aapsSchedulers.io)
.subscribe({ .subscribe({
overviewData.calcProgressPct = it.pass.finalPercent(it.progressPct) overviewData.calcProgressPct = it.finalPercent
overviewBus.send(EventUpdateOverviewCalcProgress("EventIobCalculationProgress")) overviewBus.send(EventUpdateOverviewCalcProgress("EventIobCalculationProgress"))
}, fabricPrivacy::logException) }, fabricPrivacy::logException)
disposable += rxBus disposable += rxBus