Merge pull request #2458 from miyeongkim/dev

fix divide by zero
This commit is contained in:
Milos Kozak 2023-03-13 21:29:55 +01:00 committed by GitHub
commit 89b5e9851c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -505,7 +505,7 @@ class DiaconnG8Service : DaggerService() {
val waitTime = (expectedEnd - System.currentTimeMillis()) / 1000
bolusingEvent.status = String.format(rh.gs(R.string.waitingforestimatedbolusend), if (waitTime < 0) 0 else waitTime)
var progressPecent = 0
if (totalwaitTime > waitTime) {
if (totalwaitTime > waitTime && totalwaitTime > 0) {
progressPecent = ((totalwaitTime - waitTime) * 100 / totalwaitTime).toInt()
}
bolusingEvent.percent = min(progressPecent, 100)