From 3ab77ea8d31defbfda2d447302c96ea4e35e9cae Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Fri, 6 Dec 2024 16:30:53 -0500 Subject: [PATCH] fixed bug in episode input when 0 --- frontend/src/helperComponents/Anime.svelte | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/frontend/src/helperComponents/Anime.svelte b/frontend/src/helperComponents/Anime.svelte index eac163c..49b903e 100644 --- a/frontend/src/helperComponents/Anime.svelte +++ b/frontend/src/helperComponents/Anime.svelte @@ -193,9 +193,9 @@ }; await AniListUpdateEntry(body).then( (value: AniListGetSingleAnime) => { - // in future when you inevitably add tags to typescript, until Anilist fixes the api bug - // where tags break the SaveMediaListEntry return, you'll want to use this delete line - // delete value.data.MediaList.media.tags + /* TODO in future when you inevitably add tags to typescript, until Anilist fixes the api bug + where tags break the SaveMediaListEntry return, you'll want to use this delete line + delete value.data.MediaList.media.tags */ aniListAnime.update((newValue) => { newValue = value; return newValue; @@ -397,6 +397,16 @@ submitSuccess.set(true); setTimeout(() => submitSuccess.set(false), 2000); }; + + let max = 999 + + if (currentAniListAnime.data.MediaList.media.episodes !== 0) { + max = currentAniListAnime.data.MediaList.media.episodes + } + if (currentAniListAnime.data.MediaList.media.episodes === 0 && + currentAniListAnime.data.MediaList.media.nextAiringEpisode.episode !== 0) { + max = currentAniListAnime.data.MediaList.media.nextAiringEpisode.episode - 1 + }
@@ -427,7 +437,7 @@ type="number" name="episodes" min="0" - max={currentAniListAnime.data.MediaList.media.episodes} + max={max} id="episodes" class="border {currentAniListAnime.data.MediaList .progress < 0 || @@ -448,9 +458,11 @@ .nextAiringEpisode.episode - 1 : currentAniListAnime.data.MediaList.media.episodes} + {#if currentAniListAnime.data.MediaList.media.nextAiringEpisode.episode !== 0}
of {currentAniListAnime.data.MediaList.media.episodes}
+ {/if}