From 98d4d60b2246f02d8e651d97a3b6468b3bfa89f3 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Tue, 29 Aug 2023 17:38:13 -0700 Subject: fix(mangadex): 0 progress chapter counts --- src/lib/mangadex.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/lib/mangadex.ts') diff --git a/src/lib/mangadex.ts b/src/lib/mangadex.ts index 45251a4d..9ab65d75 100644 --- a/src/lib/mangadex.ts +++ b/src/lib/mangadex.ts @@ -38,8 +38,12 @@ export const chapterCount = async (manga: Media): Promise => { let lastChapterIndex = 0; - while (lastChapterData['data'][lastChapterIndex]['attributes']['translatedLanguage'] !== 'en') { - lastChapterIndex += 1; + for (let i = 0; i < lastChapterData['data'].length; i++) { + if (lastChapterData['data'][i]['attributes']['volume'] !== null) { + lastChapterIndex = i; + + break; + } } let lastChapter = lastChapterData['data'][lastChapterIndex]['attributes']['chapter']; -- cgit v1.2.3