From a65fd4101aa31d74acf9034f87a8a89a3afd8db2 Mon Sep 17 00:00:00 2001 From: Diptesh Choudhuri Date: Wed, 1 Jan 2025 19:30:48 +0530 Subject: [PATCH] fix(frontend): add checks for handling special season for shows --- apps/frontend/app/routes/actions.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/frontend/app/routes/actions.tsx b/apps/frontend/app/routes/actions.tsx index bbe3b743ac..8349ed7718 100644 --- a/apps/frontend/app/routes/actions.tsx +++ b/apps/frontend/app/routes/actions.tsx @@ -351,6 +351,7 @@ export const action = async ({ request }: ActionFunctionArgs) => { e.seasonNumber === submission.showSeasonNumber && e.episodeNumber === submission.showEpisodeNumber, ); + const selectedEpisode = allEpisodesInShow[selectedEpisodeIndex]; const firstEpisodeOfShow = allEpisodesInShow[0]; const lastSeenEpisode = latestHistoryItem?.showExtraInformation || { episode: firstEpisodeOfShow.episodeNumber, @@ -365,11 +366,17 @@ export const action = async ({ request }: ActionFunctionArgs) => { lastSeenEpisodeIndex + (latestHistoryItem ? 1 : 0); if (selectedEpisodeIndex > firstEpisodeIndexToMark) { for (let i = firstEpisodeIndexToMark; i < selectedEpisodeIndex; i++) { - const episode = allEpisodesInShow[i]; + const currentEpisode = allEpisodesInShow[i]; + if ( + currentEpisode.seasonNumber === 0 && + selectedEpisode.seasonNumber !== 0 + ) { + continue; + } updates.push({ ...variables, - showSeasonNumber: episode.seasonNumber, - showEpisodeNumber: episode.episodeNumber, + showSeasonNumber: currentEpisode.seasonNumber, + showEpisodeNumber: currentEpisode.episodeNumber, }); } }