Set maxProgress to correct value

This commit is contained in:
Tebbe Ubben 2020-09-05 11:55:38 +02:00 committed by GitHub
parent f3d8690f5c
commit 1d88d16545
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)
}
}
}