From 9b73423d49e1e799cd82764a9ade8c75d92a28a2 Mon Sep 17 00:00:00 2001 From: sct Date: Thu, 18 Feb 2021 14:26:12 +0000 Subject: [PATCH] fix(sync): fix sonarr/plex sync fighting over availability fixes #872 --- server/job/plexsync/index.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/job/plexsync/index.ts b/server/job/plexsync/index.ts index 9cef1cfdc..486fbf908 100644 --- a/server/job/plexsync/index.ts +++ b/server/job/plexsync/index.ts @@ -543,15 +543,18 @@ class JobPlexSync { if (existingSeason) { // These ternary statements look super confusing, but they are simply // setting the status to AVAILABLE if all of a type is there, partially if some, - // and then not modifying the status if there are 0 items + // and then not modifying the status if there are 0 items. + // If the season was already available, we don't modify it as well. existingSeason.status = - totalStandard === season.episode_count + totalStandard === season.episode_count || + existingSeason.status === MediaStatus.AVAILABLE ? MediaStatus.AVAILABLE : totalStandard > 0 ? MediaStatus.PARTIALLY_AVAILABLE : existingSeason.status; existingSeason.status4k = - this.enable4kShow && total4k === season.episode_count + (this.enable4kShow && total4k === season.episode_count) || + existingSeason.status4k === MediaStatus.AVAILABLE ? MediaStatus.AVAILABLE : this.enable4kShow && total4k > 0 ? MediaStatus.PARTIALLY_AVAILABLE