Skip to content

Commit fa90481

Browse files
samuelchemlaphpbg
authored andcommitted
Fix job percent showing weird results when jobs are failed/retried
1 parent 3b7ea3a commit fa90481

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

app/src/main/java/com/phpbg/easysync/ui/MainActivity.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ import com.phpbg.easysync.ui.components.StdText
8686
import com.phpbg.easysync.ui.components.Title
8787
import com.phpbg.easysync.ui.theme.MyApplicationTheme
8888
import kotlinx.coroutines.launch
89-
import kotlin.math.max
9089
import kotlin.math.round
9190

9291

@@ -297,7 +296,7 @@ private fun Main(
297296
} else {
298297
-1
299298
}
300-
val maxJobs = max(localCount, syncedCount) + 1
299+
val maxJobs = maxOf(localCount, syncedCount, jobCount)
301300
val jobCountPercent =
302301
if (jobCount == -1) -1 else round(100.0 * (maxJobs - jobCount) / maxJobs).toInt()
303302
Row(

0 commit comments

Comments
 (0)