diff --git a/package.json b/package.json index 894ad0a..5f00828 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ui", - "version": "6.3.64", + "version": "6.3.65", "license": "BUSL-1.1", "private": true, "packageManager": "pnpm@9.14.4", diff --git a/src/lib/modules/anilist/util.ts b/src/lib/modules/anilist/util.ts index b796d40..379fe63 100644 --- a/src/lib/modules/anilist/util.ts +++ b/src/lib/modules/anilist/util.ts @@ -1,3 +1,5 @@ +import { authAggregator } from '../auth' + import type { ScheduleMedia } from './queries' import type { Media } from './types' import type { Episode, Episodes } from '../anizip/types' @@ -93,7 +95,7 @@ export function episodes (media: Pick= progress) return + // there's an edge case here that episodes returns 1, because anilist doesn't have episode count for an airing show without an expected end date + // this can set a media to completed when it shouldn't be, so we check if the media is finished or has episodes + const canBeCompleted = media.status === 'FINISHED' || media.episodes != null + const status = - totalEps === progress + totalEps === progress && canBeCompleted ? 'COMPLETED' : media.mediaListEntry?.status === 'REPEATING' ? 'REPEATING' : 'CURRENT' @@ -124,26 +127,26 @@ export default new class AuthAggregator { } delete (media: Media) { - const syncSettings = get(this.syncSettings) + const sync = get(this.syncSettings) return Promise.allSettled([ - this.anilist() && syncSettings.al && client.deleteEntry(media), - this.kitsu() && syncSettings.kitsu && kitsu.deleteEntry(media), - syncSettings.local && local.deleteEntry(media) + sync.al && this.anilist() && client.deleteEntry(media), + sync.kitsu && this.kitsu() && kitsu.deleteEntry(media), + sync.local && local.deleteEntry(media) ]) } entry (variables: VariablesOf) { - const syncSettings = get(this.syncSettings) + const sync = get(this.syncSettings) variables.lists ??= [] if (!variables.lists.includes('Watched using Hayase')) { variables.lists.push('Watched using Hayase') } return Promise.allSettled([ - this.anilist() && syncSettings.al && client.entry(variables), - this.kitsu() && syncSettings.kitsu && kitsu.entry(variables), - syncSettings.local && local.entry(variables) + sync.al && this.anilist() && client.entry(variables), + sync.kitsu && this.kitsu() && kitsu.entry(variables), + sync.local && local.entry(variables) ]) } }()