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:
@@ -801,7 +801,7 @@ export class MigrationManager {
|
||||
mainSignal: AbortSignal,
|
||||
options: MigrationBulkSearchSettings,
|
||||
): Promise<void> {
|
||||
const { selectHighestChapterNumberSource, ignoreOutdatedMatches } = options;
|
||||
const { selectHighestChapterNumberSource, ignoreOutdatedMatches, requireAdditionalChapters } = options;
|
||||
|
||||
const state = MigrationManager.getState();
|
||||
const entry = state.entries[mangaId];
|
||||
@@ -909,6 +909,8 @@ export class MigrationManager {
|
||||
latestChapterNumber > selectedMatchLatestChapterNumber;
|
||||
const hasNewerChapter = hasNewerChapterVsEntry && hasNewerChapterVsSelectedMatch;
|
||||
|
||||
const isOutdated = latestChapterNumber <= entryLatestChapterNumber;
|
||||
|
||||
const hasSameLatestChapterAsSelectedMatch =
|
||||
!!draftMatchEntry && selectedMatchLatestChapterNumber === latestChapterNumber;
|
||||
|
||||
@@ -917,7 +919,8 @@ export class MigrationManager {
|
||||
destSourceId,
|
||||
);
|
||||
|
||||
const ignoreOutdatedMatch = ignoreOutdatedMatches && !hasNewerChapter;
|
||||
const ignoreOutdatedMatch = ignoreOutdatedMatches && isOutdated;
|
||||
const satisfiesRequireAdditionalChapters = !requireAdditionalChapters || hasNewerChapter;
|
||||
const isPreferredSourcePriorityMatch =
|
||||
hasHigherSourcePriority && !selectHighestChapterNumberSource;
|
||||
const isPreferredChapterNumberMatch =
|
||||
@@ -929,6 +932,7 @@ export class MigrationManager {
|
||||
const isPreferredMatch =
|
||||
!draftEntry.isManualSelection &&
|
||||
!ignoreOutdatedMatch &&
|
||||
satisfiesRequireAdditionalChapters &&
|
||||
(isPreferredSourcePriorityMatch || isPreferredChapterNumberMatch);
|
||||
if (isPreferredMatch) {
|
||||
draftEntry.selectedMatchMangaId = bestMatch.id;
|
||||
|
||||
Reference in New Issue
Block a user