Fixed: Manual Import multiple episode selection

Closes #5543
This commit is contained in:
Mark McDowall 2023-04-10 22:04:58 -07:00
parent b2c43fb2a6
commit 48a82ad711
2 changed files with 15 additions and 10 deletions

View File

@ -58,7 +58,7 @@ function episodesSelector() {
} }
export interface SelectedEpisode { export interface SelectedEpisode {
fileId: number; id: number;
episodes: Episode[]; episodes: Episode[];
} }
@ -163,7 +163,7 @@ function SelectEpisodeModalContent(props: SelectEpisodeModalContentProps) {
return a.seasonNumber - b.seasonNumber; return a.seasonNumber - b.seasonNumber;
}); });
const mappedEpisodes = selectedIds.map((fileId, index): SelectedEpisode => { const mappedEpisodes = selectedIds.map((id, index): SelectedEpisode => {
const startingIndex = index * episodesPerFile; const startingIndex = index * episodesPerFile;
const episodes = sortedEpisodes.slice( const episodes = sortedEpisodes.slice(
startingIndex, startingIndex,
@ -171,7 +171,7 @@ function SelectEpisodeModalContent(props: SelectEpisodeModalContentProps) {
); );
return { return {
fileId: fileId as number, id: id as number,
episodes, episodes,
}; };
}); });

View File

@ -51,6 +51,7 @@ import {
reprocessInteractiveImportItems, reprocessInteractiveImportItems,
setInteractiveImportMode, setInteractiveImportMode,
setInteractiveImportSort, setInteractiveImportSort,
updateInteractiveImportItem,
updateInteractiveImportItems, updateInteractiveImportItems,
} from 'Store/Actions/interactiveImportActions'; } from 'Store/Actions/interactiveImportActions';
import createClientSideCollectionSelector from 'Store/Selectors/createClientSideCollectionSelector'; import createClientSideCollectionSelector from 'Store/Selectors/createClientSideCollectionSelector';
@ -616,13 +617,17 @@ function InteractiveImportModalContent(
); );
const onEpisodesSelect = useCallback( const onEpisodesSelect = useCallback(
(episodes: SelectedEpisode[]) => { (selectedEpisodes: SelectedEpisode[]) => {
selectedEpisodes.forEach((selectedEpisode) => {
const { id, episodes } = selectedEpisode;
dispatch( dispatch(
updateInteractiveImportItems({ updateInteractiveImportItem({
ids: selectedIds, id,
episodes, episodes,
}) })
); );
});
dispatch(reprocessInteractiveImportItems({ ids: selectedIds })); dispatch(reprocessInteractiveImportItems({ ids: selectedIds }));