Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion server/lib/scanners/baseScanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,14 @@ class BaseScanner<T> {
) ?? []
).length;

for (const season of seasons) {
for (const rawSeason of seasons) {
// Files can't promote a season the provider reports as empty.
// Zeroing the counts leaves any existing status for availabilitySync to judge.
const season =
rawSeason.totalEpisodes > 0
? rawSeason
: { ...rawSeason, episodes: 0, episodes4k: 0 };

const existingSeason = media?.seasons.find(
(es) => es.seasonNumber === season.seasonNumber
);
Expand Down
4 changes: 2 additions & 2 deletions src/components/RequestModal/TvRequestModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ const TvRequestModal = ({
: hasPermission(Permission.MANAGE_REQUESTS)
? intl.formatMessage(messages.approve)
: intl.formatMessage(messages.edit)
: getAllRequestedSeasons().length >= getAllSeasons().length
: unrequestedSeasons.length === 0
? intl.formatMessage(messages.alreadyrequested)
: !settings.currentSettings.partialRequestsEnabled
? intl.formatMessage(
Expand All @@ -441,7 +441,7 @@ const TvRequestModal = ({
unrequestedSeasons.length > quota.tv.limit &&
!requestOverrides?.ignoreQuota
? true
: getAllRequestedSeasons().length >= getAllSeasons().length ||
: unrequestedSeasons.length === 0 ||
(settings.currentSettings.partialRequestsEnabled &&
selectedSeasons.length === 0)
}
Expand Down
29 changes: 18 additions & 11 deletions src/components/TvDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -309,19 +309,26 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
return [...requestedSeasons, ...availableSeasons];
};

const showHasSpecials = data.seasons.some(
(season) =>
season.seasonNumber === 0 &&
settings.currentSettings.enableSpecialEpisodes
);
// Mirrors the season list the request modal offers, so the two agree.
const requestableSeasons = data.seasons
.filter(
(season) =>
season.episodeCount !== 0 &&
(settings.currentSettings.enableSpecialEpisodes ||
season.seasonNumber !== 0)
)
.map((season) => season.seasonNumber);

const isSeasonSetComplete = (is4k: boolean) => {
const requested = getAllRequestedSeasons(is4k);
return requestableSeasons.every((seasonNumber) =>
requested.includes(seasonNumber)
);
Comment thread
Copilot marked this conversation as resolved.
};
Comment thread
coderabbitai[bot] marked this conversation as resolved.

const isComplete =
(showHasSpecials ? seasonCount + 1 : seasonCount) <=
getAllRequestedSeasons(false).length;
const isComplete = isSeasonSetComplete(false);

const is4kComplete =
(showHasSpecials ? seasonCount + 1 : seasonCount) <=
getAllRequestedSeasons(true).length;
const is4kComplete = isSeasonSetComplete(true);

const streamingRegion = user?.settings?.streamingRegion
? user.settings.streamingRegion
Expand Down
Loading