Update sorting of bulk migration other matches
1. Latest chapter 2. Source priority 3. Title
This commit is contained in:
@@ -22,6 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|||||||
- (**Migration**) Sort entries in search/execution page by title
|
- (**Migration**) Sort entries in search/execution page by title
|
||||||
- (**Migration**) Prevent a manual selected match from getting automatically overwritten by a new-found match
|
- (**Migration**) Prevent a manual selected match from getting automatically overwritten by a new-found match
|
||||||
- (**Migration**) Abort active search when selecting a match through the manual search
|
- (**Migration**) Abort active search when selecting a match through the manual search
|
||||||
|
- (**Migration**) Sort unselected matched entries by 1. their latest chapter, 2. their source priority, 3. their title
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|||||||
@@ -672,6 +672,12 @@ export class MigrationManager {
|
|||||||
return destinationSourceIds;
|
return destinationSourceIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static getSourcePriority(mangaSourceId: SourceIdInfo['id'], sourceId: SourceIdInfo['id']): number {
|
||||||
|
const destinationSourceIds = MigrationManager.getDestinationSourceIds(mangaSourceId);
|
||||||
|
|
||||||
|
return destinationSourceIds.indexOf(sourceId);
|
||||||
|
}
|
||||||
|
|
||||||
private static getHigherPrioritySourceIds(
|
private static getHigherPrioritySourceIds(
|
||||||
mangaSourceId: SourceIdInfo['id'],
|
mangaSourceId: SourceIdInfo['id'],
|
||||||
destSourceId: SourceIdInfo['id'],
|
destSourceId: SourceIdInfo['id'],
|
||||||
|
|||||||
@@ -212,7 +212,22 @@ export const MigrationEntry = memo(
|
|||||||
() =>
|
() =>
|
||||||
entry.searchMatches
|
entry.searchMatches
|
||||||
.filter((searchMatch) => searchMatch.id !== entry.selectedMatchMangaId)
|
.filter((searchMatch) => searchMatch.id !== entry.selectedMatchMangaId)
|
||||||
.sort((a, b) => (b.latestChapterNumber ?? 0) - (a.latestChapterNumber ?? 0)),
|
.sort((a, b) => {
|
||||||
|
const sortByLatestChapter = (b.latestChapterNumber ?? 0) - (a.latestChapterNumber ?? 0);
|
||||||
|
if (sortByLatestChapter) {
|
||||||
|
return sortByLatestChapter;
|
||||||
|
}
|
||||||
|
|
||||||
|
const aSourcePriority = MigrationManager.getSourcePriority(entry.sourceId, a.sourceId);
|
||||||
|
const bSourcePriority = MigrationManager.getSourcePriority(entry.sourceId, b.sourceId);
|
||||||
|
|
||||||
|
const sortBySourcePriority = bSourcePriority - aSourcePriority;
|
||||||
|
if (sortBySourcePriority) {
|
||||||
|
return sortBySourcePriority;
|
||||||
|
}
|
||||||
|
|
||||||
|
return a.title.localeCompare(b.title);
|
||||||
|
}),
|
||||||
[entry.searchMatches, entry.selectedMatchMangaId],
|
[entry.searchMatches, entry.selectedMatchMangaId],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user