fix: corrected media status switching away from deleted

pull/3460/head
Brandon 2 years ago committed by OwsleyJr
parent 16677a4cdf
commit 53c51d1837

@ -106,7 +106,7 @@ class BaseScanner<T> {
});
await requestRepository.update(
{ media: { id: request?.id } },
{ id: request?.id },
{ status: MediaRequestStatus.COMPLETED }
);
}
@ -215,11 +215,11 @@ class BaseScanner<T> {
}
if (changedExisting) {
if (existing['status'] === MediaStatus.AVAILABLE) {
if (existing.status === MediaStatus.AVAILABLE) {
this.requestUpdater(existing.id, false);
}
if (existing['status4k'] === MediaStatus.AVAILABLE) {
if (existing.status4k === MediaStatus.AVAILABLE) {
this.requestUpdater(existing.id, true);
}
@ -352,7 +352,9 @@ class BaseScanner<T> {
? MediaStatus.AVAILABLE
: season.episodes > 0
? MediaStatus.PARTIALLY_AVAILABLE
: !season.is4kOverride && season.processing
: !season.is4kOverride &&
season.processing &&
existingSeason.status !== MediaStatus.DELETED
? MediaStatus.PROCESSING
: existingSeason.status;
@ -365,15 +367,25 @@ class BaseScanner<T> {
? MediaStatus.AVAILABLE
: this.enable4kShow && season.episodes4k > 0
? MediaStatus.PARTIALLY_AVAILABLE
: season.is4kOverride && season.processing
: season.is4kOverride &&
season.processing &&
existingSeason.status !== MediaStatus.DELETED
? MediaStatus.PROCESSING
: existingSeason.status4k;
if (existingSeason['status'] === MediaStatus.AVAILABLE) {
if (
(season.totalEpisodes === season.episodes && season.episodes > 0) ||
existingSeason.status === MediaStatus.AVAILABLE
) {
this.seasonRequestUpdater(media?.id, season.seasonNumber, false);
}
if (existingSeason['status4k'] === MediaStatus.AVAILABLE) {
if (
(this.enable4kShow &&
season.episodes4k === season.totalEpisodes &&
season.episodes4k > 0) ||
existingSeason.status4k === MediaStatus.AVAILABLE
) {
this.seasonRequestUpdater(media?.id, season.seasonNumber, true);
}
} else {
@ -492,12 +504,18 @@ class BaseScanner<T> {
// the status
const shouldStayAvailable =
media.status === MediaStatus.AVAILABLE &&
newSeasons.filter((season) => season.status !== MediaStatus.UNKNOWN)
.length === 0;
newSeasons.filter(
(season) =>
season.status !== MediaStatus.UNKNOWN &&
season.status !== MediaStatus.DELETED
).length === 0;
const shouldStayAvailable4k =
media.status4k === MediaStatus.AVAILABLE &&
newSeasons.filter((season) => season.status4k !== MediaStatus.UNKNOWN)
.length === 0;
newSeasons.filter(
(season) =>
season.status4k !== MediaStatus.UNKNOWN &&
season.status4k !== MediaStatus.DELETED
).length === 0;
media.status =
isAllStandardSeasons || shouldStayAvailable
@ -508,11 +526,13 @@ class BaseScanner<T> {
season.status === MediaStatus.AVAILABLE
)
? MediaStatus.PARTIALLY_AVAILABLE
: !seasons.length ||
: (!seasons.length && media.status !== MediaStatus.DELETED) ||
media.seasons.some(
(season) => season.status === MediaStatus.PROCESSING
)
? MediaStatus.PROCESSING
: media.status === MediaStatus.DELETED
? MediaStatus.DELETED
: MediaStatus.UNKNOWN;
media.status4k =
(isAll4kSeasons || shouldStayAvailable4k) && this.enable4kShow
@ -524,11 +544,13 @@ class BaseScanner<T> {
season.status4k === MediaStatus.AVAILABLE
)
? MediaStatus.PARTIALLY_AVAILABLE
: !seasons.length ||
: (!seasons.length && media.status4k !== MediaStatus.DELETED) ||
media.seasons.some(
(season) => season.status4k === MediaStatus.PROCESSING
)
? MediaStatus.PROCESSING
: media.status4k === MediaStatus.DELETED
? MediaStatus.DELETED
: MediaStatus.UNKNOWN;
if (isAllStandardSeasons) {
@ -600,11 +622,11 @@ class BaseScanner<T> {
: MediaStatus.UNKNOWN,
});
if (newMedia['status'] === MediaStatus.AVAILABLE) {
if (isAllStandardSeasons) {
this.requestUpdater(newMedia.id, false);
}
if (newMedia['status4k'] === MediaStatus.AVAILABLE) {
if (isAll4kSeasons && this.enable4kShow) {
this.requestUpdater(newMedia.id, true);
}
await mediaRepository.save(newMedia);

@ -33,7 +33,9 @@ export class MediaSubscriber implements EntitySubscriberInterface<Media> {
id: entity.id,
},
is4k,
status: Not(MediaRequestStatus.DECLINED),
status: Not(
MediaRequestStatus.DECLINED && MediaRequestStatus.COMPLETED
),
},
});
@ -116,7 +118,9 @@ export class MediaSubscriber implements EntitySubscriberInterface<Media> {
id: entity.id,
},
is4k,
status: Not(MediaRequestStatus.DECLINED),
status: Not(
MediaRequestStatus.DECLINED && MediaRequestStatus.COMPLETED
),
},
});
const request = requests.find(

@ -21,8 +21,6 @@ const RecentRequestsSlider = () => {
return null;
}
console.log({ requests });
return (
<>
<div className="slider-header">

@ -100,10 +100,6 @@ const RequestList = () => {
);
}, [currentFilter, currentSort, currentPageSize]);
console.log({ currentFilter });
console.log({ data });
if (!data && !error) {
return <LoadingSpinner />;
}

@ -78,7 +78,8 @@ const CollectionRequestModal = ({
.filter(
(request) =>
request.is4k === is4k &&
request.status !== MediaRequestStatus.DECLINED
request.status !== MediaRequestStatus.DECLINED &&
request.status !== MediaRequestStatus.COMPLETED
)
.map((part) => part.id),
];
@ -167,7 +168,9 @@ const CollectionRequestModal = ({
return (part?.mediaInfo?.requests ?? []).find(
(request) =>
request.is4k === is4k && request.status !== MediaRequestStatus.DECLINED
request.is4k === is4k &&
request.status !== MediaRequestStatus.DECLINED &&
request.status !== MediaRequestStatus.COMPLETED
);
};
@ -241,6 +244,9 @@ const CollectionRequestModal = ({
{ type: 'or' }
);
console.log('getALL', getAllRequestedParts().includes(8011));
console.log('getPART', getPartRequest(8011));
return (
<Modal
loading={(!data && !error) || !quota}
@ -342,7 +348,9 @@ const CollectionRequestModal = ({
const partMedia =
part.mediaInfo &&
part.mediaInfo[is4k ? 'status4k' : 'status'] !==
MediaStatus.UNKNOWN
MediaStatus.UNKNOWN &&
part.mediaInfo[is4k ? 'status4k' : 'status'] !==
MediaStatus.DELETED
? part.mediaInfo
: undefined;

@ -243,7 +243,8 @@ const TvRequestModal = ({
.filter(
(request) =>
request.is4k === is4k &&
request.status !== MediaRequestStatus.DECLINED
request.status !== MediaRequestStatus.DECLINED &&
request.status !== MediaRequestStatus.COMPLETED
)
.reduce((requestedSeasons, request) => {
return [
@ -341,7 +342,8 @@ const TvRequestModal = ({
(data.mediaInfo.requests || []).filter(
(request) =>
request.is4k === is4k &&
request.status !== MediaRequestStatus.DECLINED
request.status !== MediaRequestStatus.DECLINED &&
request.status !== MediaRequestStatus.COMPLETED
).length > 0
) {
data.mediaInfo.requests
@ -349,7 +351,9 @@ const TvRequestModal = ({
.forEach((request) => {
if (!seasonRequest) {
seasonRequest = request.seasons.find(
(season) => season.seasonNumber === seasonNumber
(season) =>
season.seasonNumber === seasonNumber &&
season.status !== MediaRequestStatus.COMPLETED
);
}
});

Loading…
Cancel
Save