From e9ccd2e358bf1a0df149ce54c1b0a2fa668bba67 Mon Sep 17 00:00:00 2001 From: KhooLy <73142442+KhooLy@users.noreply.github.com> Date: Sun, 19 Jul 2026 17:12:45 +0300 Subject: [PATCH] Push actual episode number to AniList instead of watched-episode count When marking a show COMPLETED on AniList, progress now comes from parsing the season/episode locator off each watched episode's ID and taking the max episode number, falling back to episodes.size only if that parsing yields nothing. Previously it always pushed episodes.size, which undercounts progress for shows with specials or merged multi-season watch history. --- .../fluxa/app/data/repository/ExternalSyncPushCoordinator.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/data/src/androidMain/kotlin/com/fluxa/app/data/repository/ExternalSyncPushCoordinator.kt b/data/src/androidMain/kotlin/com/fluxa/app/data/repository/ExternalSyncPushCoordinator.kt index a81b129..d1b9e53 100644 --- a/data/src/androidMain/kotlin/com/fluxa/app/data/repository/ExternalSyncPushCoordinator.kt +++ b/data/src/androidMain/kotlin/com/fluxa/app/data/repository/ExternalSyncPushCoordinator.kt @@ -63,7 +63,9 @@ class ExternalSyncPushCoordinator @Inject constructor( if (watched && !profile.anilistAccessToken.isNullOrBlank()) { launch { val token = profile.anilistAccessToken - runCatching { pushAnilistListEntry(token, meta, "COMPLETED", episodes.size.takeIf { it > 0 }) } + val progress = episodes.mapNotNull { it.id?.let { id -> TraktIntegration.episodeLocator(id)?.episode } }.maxOrNull() + ?: episodes.size.takeIf { it > 0 } + runCatching { pushAnilistListEntry(token, meta, "COMPLETED", progress) } .onSuccess { success -> if (success) profileManager.clearExternalSyncFailure(profile.id, "anilist") else profileManager.recordExternalSyncFailure(profile.id, "anilist")