Skip to content

Commit 13da276

Browse files
committed
Fix synced percentage when files are dynced outside of regular synced URIs
1 parent 784f303 commit 13da276

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,9 @@ private fun Main(
315315
Spacer(modifier = Modifier.height(16.dp))
316316

317317
val syncedPercent = if (localCount > 0 && syncedCount >= 0) {
318-
round(100.0 * syncedCount / localCount).toInt()
318+
// localCount represents local files eligible for sync
319+
// syncedCount represents files already synced, which includes local files and dav files that are synced outside of regular URIs (e.g. you sync a `/Foo` folder on your dav server)
320+
round(100.0 * syncedCount / maxOf(localCount, syncedCount)).toInt()
319321
} else if (syncedCount == 0) {
320322
0
321323
} else {

0 commit comments

Comments
 (0)