Use MigrationEntries::hasStatus
This commit is contained in:
@@ -52,7 +52,11 @@ export class MigrationEntries {
|
|||||||
public static getMigratable(entries: TMigrationEntry[]): MigratableEntry[] {
|
public static getMigratable(entries: TMigrationEntry[]): MigratableEntry[] {
|
||||||
return Object.values(entries).filter(
|
return Object.values(entries).filter(
|
||||||
(entry): entry is MigratableEntry =>
|
(entry): entry is MigratableEntry =>
|
||||||
[MigrationEntryStatus.SEARCH_COMPLETE, MigrationEntryStatus.MIGRATING].includes(entry.status) &&
|
MigrationEntries.hasStatus(
|
||||||
|
entry,
|
||||||
|
MigrationEntryStatus.SEARCH_COMPLETE,
|
||||||
|
MigrationEntryStatus.MIGRATING,
|
||||||
|
) &&
|
||||||
!entry.isExcluded &&
|
!entry.isExcluded &&
|
||||||
entry.selectedMatchMangaId != null &&
|
entry.selectedMatchMangaId != null &&
|
||||||
entry.selectedMatchSourceId != null,
|
entry.selectedMatchSourceId != null,
|
||||||
|
|||||||
@@ -1090,9 +1090,8 @@ export class MigrationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { signal } = MigrationManager.getOrCreateAbortController();
|
const { signal } = MigrationManager.getOrCreateAbortController();
|
||||||
const { status } = entry;
|
|
||||||
|
|
||||||
if (status === MigrationEntryStatus.SEARCH_FAILED) {
|
if (MigrationEntries.hasStatus(entry, MigrationEntryStatus.SEARCH_FAILED)) {
|
||||||
MigrationManager.updateState((draft) => {
|
MigrationManager.updateState((draft) => {
|
||||||
draft.searchProgress.completed -= 1;
|
draft.searchProgress.completed -= 1;
|
||||||
draft.searchProgress.failed -= 1;
|
draft.searchProgress.failed -= 1;
|
||||||
@@ -1107,7 +1106,7 @@ export class MigrationManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status === MigrationEntryStatus.MIGRATION_FAILED) {
|
if (MigrationEntries.hasStatus(entry, MigrationEntryStatus.MIGRATION_FAILED)) {
|
||||||
MigrationManager.updateState((draft) => {
|
MigrationManager.updateState((draft) => {
|
||||||
draft.migrationProgress.completed -= 1;
|
draft.migrationProgress.completed -= 1;
|
||||||
draft.migrationProgress.failed -= 1;
|
draft.migrationProgress.failed -= 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user