Use MigrationEntries::hasStatus

This commit is contained in:
schroda
2026-05-22 14:22:01 +02:00
parent 552965e403
commit afb2c0cc0f
2 changed files with 7 additions and 4 deletions

View File

@@ -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,

View File

@@ -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;