Skip to content

Commit

Permalink
fix(frontend): add checks for handling special season for shows
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnisDa committed Jan 1, 2025
1 parent 30f503b commit a65fd41
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions apps/frontend/app/routes/actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
});
}
}
Expand Down

0 comments on commit a65fd41

Please sign in to comment.