Optionally ignore outdated matches during bulk migration
The original "ignore outdated matches" setting added with 3d514d357a is not really ignoring outdated matches but requires matches to be ahead of the current source.
The variable naming is not matching the logic and is confusing.
This commit is contained in:
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|||||||
|
|
||||||
## [Unreleased] (Preview)
|
## [Unreleased] (Preview)
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- (**Migration**) Add a search option to ignore outdated matches
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- (**Migration**) Show "abort" button during active bulk migration search
|
- (**Migration**) Show "abort" button during active bulk migration search
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ export type MetadataMigrationSettings = {
|
|||||||
export interface MigrationBulkSearchSettings {
|
export interface MigrationBulkSearchSettings {
|
||||||
selectHighestChapterNumberSource: boolean;
|
selectHighestChapterNumberSource: boolean;
|
||||||
ignoreOutdatedMatches: boolean;
|
ignoreOutdatedMatches: boolean;
|
||||||
|
requireAdditionalChapters: boolean;
|
||||||
performAdvancedSearch: boolean;
|
performAdvancedSearch: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -801,7 +801,7 @@ export class MigrationManager {
|
|||||||
mainSignal: AbortSignal,
|
mainSignal: AbortSignal,
|
||||||
options: MigrationBulkSearchSettings,
|
options: MigrationBulkSearchSettings,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const { selectHighestChapterNumberSource, ignoreOutdatedMatches } = options;
|
const { selectHighestChapterNumberSource, ignoreOutdatedMatches, requireAdditionalChapters } = options;
|
||||||
|
|
||||||
const state = MigrationManager.getState();
|
const state = MigrationManager.getState();
|
||||||
const entry = state.entries[mangaId];
|
const entry = state.entries[mangaId];
|
||||||
@@ -909,6 +909,8 @@ export class MigrationManager {
|
|||||||
latestChapterNumber > selectedMatchLatestChapterNumber;
|
latestChapterNumber > selectedMatchLatestChapterNumber;
|
||||||
const hasNewerChapter = hasNewerChapterVsEntry && hasNewerChapterVsSelectedMatch;
|
const hasNewerChapter = hasNewerChapterVsEntry && hasNewerChapterVsSelectedMatch;
|
||||||
|
|
||||||
|
const isOutdated = latestChapterNumber <= entryLatestChapterNumber;
|
||||||
|
|
||||||
const hasSameLatestChapterAsSelectedMatch =
|
const hasSameLatestChapterAsSelectedMatch =
|
||||||
!!draftMatchEntry && selectedMatchLatestChapterNumber === latestChapterNumber;
|
!!draftMatchEntry && selectedMatchLatestChapterNumber === latestChapterNumber;
|
||||||
|
|
||||||
@@ -917,7 +919,8 @@ export class MigrationManager {
|
|||||||
destSourceId,
|
destSourceId,
|
||||||
);
|
);
|
||||||
|
|
||||||
const ignoreOutdatedMatch = ignoreOutdatedMatches && !hasNewerChapter;
|
const ignoreOutdatedMatch = ignoreOutdatedMatches && isOutdated;
|
||||||
|
const satisfiesRequireAdditionalChapters = !requireAdditionalChapters || hasNewerChapter;
|
||||||
const isPreferredSourcePriorityMatch =
|
const isPreferredSourcePriorityMatch =
|
||||||
hasHigherSourcePriority && !selectHighestChapterNumberSource;
|
hasHigherSourcePriority && !selectHighestChapterNumberSource;
|
||||||
const isPreferredChapterNumberMatch =
|
const isPreferredChapterNumberMatch =
|
||||||
@@ -929,6 +932,7 @@ export class MigrationManager {
|
|||||||
const isPreferredMatch =
|
const isPreferredMatch =
|
||||||
!draftEntry.isManualSelection &&
|
!draftEntry.isManualSelection &&
|
||||||
!ignoreOutdatedMatch &&
|
!ignoreOutdatedMatch &&
|
||||||
|
satisfiesRequireAdditionalChapters &&
|
||||||
(isPreferredSourcePriorityMatch || isPreferredChapterNumberMatch);
|
(isPreferredSourcePriorityMatch || isPreferredChapterNumberMatch);
|
||||||
if (isPreferredMatch) {
|
if (isPreferredMatch) {
|
||||||
draftEntry.selectedMatchMangaId = bestMatch.id;
|
draftEntry.selectedMatchMangaId = bestMatch.id;
|
||||||
|
|||||||
@@ -29,13 +29,35 @@ export const MigrationBulkSearchOptionsDialog = ({
|
|||||||
const { t } = useLingui();
|
const { t } = useLingui();
|
||||||
|
|
||||||
const [selectHighestChapterNumberSource, setSelectHighestChapterNumberSource] = useState(false);
|
const [selectHighestChapterNumberSource, setSelectHighestChapterNumberSource] = useState(false);
|
||||||
const [ignoreOutdatedMatches, setIgnoreOutdatesMatches] = useState(false);
|
const [ignoreOutdatedMatches, setIgnoreOutdatedMatches] = useState(false);
|
||||||
|
const [requireAdditionalChapters, setRequireAdditionalChapters] = useState(false);
|
||||||
const [performAdvancedSearch, setPerformAdvancedSearch] = useState(false);
|
const [performAdvancedSearch, setPerformAdvancedSearch] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={isVisible} fullWidth onClose={onDismiss} onTransitionExited={onExitComplete}>
|
<Dialog open={isVisible} fullWidth onClose={onDismiss} onTransitionExited={onExitComplete}>
|
||||||
<DialogTitle>{t`Search options`}</DialogTitle>
|
<DialogTitle>{t`Search options`}</DialogTitle>
|
||||||
<DialogContent dividers>
|
<DialogContent dividers>
|
||||||
|
<CheckboxInput
|
||||||
|
label={
|
||||||
|
<Stack
|
||||||
|
sx={{
|
||||||
|
// Padding comes from the MUI Checkbox component
|
||||||
|
pt: '9px',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Typography>{t`Ignore matches that are behind in chapters`}</Typography>
|
||||||
|
<Typography
|
||||||
|
variant="body2"
|
||||||
|
color="textSecondary"
|
||||||
|
>{t`Only automatically select matches if they have at least the same latest chapter. They will still be shown in the found matches`}</Typography>
|
||||||
|
</Stack>
|
||||||
|
}
|
||||||
|
sx={{
|
||||||
|
alignItems: 'start',
|
||||||
|
}}
|
||||||
|
checked={ignoreOutdatedMatches}
|
||||||
|
onChange={(_, checked) => setIgnoreOutdatedMatches(checked)}
|
||||||
|
/>
|
||||||
<CheckboxInput
|
<CheckboxInput
|
||||||
label={
|
label={
|
||||||
<Stack
|
<Stack
|
||||||
@@ -54,8 +76,8 @@ export const MigrationBulkSearchOptionsDialog = ({
|
|||||||
sx={{
|
sx={{
|
||||||
alignItems: 'start',
|
alignItems: 'start',
|
||||||
}}
|
}}
|
||||||
checked={ignoreOutdatedMatches}
|
checked={requireAdditionalChapters}
|
||||||
onChange={(_, checked) => setIgnoreOutdatesMatches(checked)}
|
onChange={(_, checked) => setRequireAdditionalChapters(checked)}
|
||||||
/>
|
/>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogContent dividers>
|
<DialogContent dividers>
|
||||||
@@ -129,6 +151,7 @@ export const MigrationBulkSearchOptionsDialog = ({
|
|||||||
onSubmit({
|
onSubmit({
|
||||||
selectHighestChapterNumberSource,
|
selectHighestChapterNumberSource,
|
||||||
ignoreOutdatedMatches,
|
ignoreOutdatedMatches,
|
||||||
|
requireAdditionalChapters,
|
||||||
performAdvancedSearch,
|
performAdvancedSearch,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1845,6 +1845,10 @@ msgstr "Ignore automatic chapter downloads for entries with unread chapters"
|
|||||||
msgid "Ignore filters when searching"
|
msgid "Ignore filters when searching"
|
||||||
msgstr "Ignore filters when searching"
|
msgstr "Ignore filters when searching"
|
||||||
|
|
||||||
|
#: src/features/migration/components/MigrationBulkSearchOptionsDialog.tsx
|
||||||
|
msgid "Ignore matches that are behind in chapters"
|
||||||
|
msgstr "Ignore matches that are behind in chapters"
|
||||||
|
|
||||||
#: src/features/migration/components/MigrationBulkSearchOptionsDialog.tsx
|
#: src/features/migration/components/MigrationBulkSearchOptionsDialog.tsx
|
||||||
msgid "Ignore matches without newer chapters"
|
msgid "Ignore matches without newer chapters"
|
||||||
msgstr "Ignore matches without newer chapters"
|
msgstr "Ignore matches without newer chapters"
|
||||||
@@ -2558,6 +2562,10 @@ msgstr "Ongoing"
|
|||||||
msgid "Only automatically select matches if they have additional chapters. They will still be shown in the found matches"
|
msgid "Only automatically select matches if they have additional chapters. They will still be shown in the found matches"
|
||||||
msgstr "Only automatically select matches if they have additional chapters. They will still be shown in the found matches"
|
msgstr "Only automatically select matches if they have additional chapters. They will still be shown in the found matches"
|
||||||
|
|
||||||
|
#: src/features/migration/components/MigrationBulkSearchOptionsDialog.tsx
|
||||||
|
msgid "Only automatically select matches if they have at least the same latest chapter. They will still be shown in the found matches"
|
||||||
|
msgstr "Only automatically select matches if they have at least the same latest chapter. They will still be shown in the found matches"
|
||||||
|
|
||||||
#: src/features/migration/Migration.constants.ts
|
#: src/features/migration/Migration.constants.ts
|
||||||
msgid "Only outdated matches found"
|
msgid "Only outdated matches found"
|
||||||
msgstr "Only outdated matches found"
|
msgstr "Only outdated matches found"
|
||||||
|
|||||||
Reference in New Issue
Block a user