From 1d88d165453fdada2bb323c275f25ba25128a10c Mon Sep 17 00:00:00 2001 From: Tebbe Ubben Date: Sat, 5 Sep 2020 11:55:38 +0200 Subject: [PATCH] Set maxProgress to correct value --- .../plugins/general/openhumans/OpenHumansUploader.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/openhumans/OpenHumansUploader.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/openhumans/OpenHumansUploader.kt index ee930d78f5..72981db972 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/openhumans/OpenHumansUploader.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/openhumans/OpenHumansUploader.kt @@ -356,7 +356,7 @@ class OpenHumansUploader @Inject constructor( if (currentProgress % 1000L == 0L) showOngoingNotification(maxProgress, currentProgress) } copyDisposable = Completable.fromCallable { MainApp.getDbHelper().clearOpenHumansQueue() } - .andThen(Single.defer { Single.just(MainApp.getDbHelper().countOfAllRows) }) + .andThen(Single.defer { Single.just(MainApp.getDbHelper().countOfAllRows + treatmentsPlugin.service.count()) }) .doOnSuccess { maxProgress = it } .flatMapObservable { Observable.defer { Observable.fromIterable(treatmentsPlugin.service.treatmentData) } } .map { enqueueTreatment(it); increaseCounter() } @@ -648,4 +648,4 @@ class OpenHumansUploader @Inject constructor( private fun onSharedPreferenceChanged(event: EventPreferenceChange) { if (event.changedKey == "key_oh_charging_only" && isSetup) scheduleWorker(true) } -} \ No newline at end of file +}