mirror of
https://github.com/FluxaMedia/fluxa.git
synced 2026-07-30 21:49:14 +00:00
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.
This commit is contained in:
parent
f4ea52a890
commit
e9ccd2e358
1 changed files with 3 additions and 1 deletions
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Reference in a new issue