diff options
| author | Fuwn <[email protected]> | 2023-08-30 16:31:01 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-08-30 16:31:01 -0700 |
| commit | 60985ce13d06161a54a0c3d8859164177c5c5864 (patch) | |
| tree | 1d12783f5390d558bd1721ccec0cee53573a137f /src/lib | |
| parent | ci(docker): pin bun to 0.8.1 (diff) | |
| download | due.moe-60985ce13d06161a54a0c3d8859164177c5c5864.tar.xz due.moe-60985ce13d06161a54a0c3d8859164177c5c5864.zip | |
fix(mangadex): optimise and fix chapter language
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/mangadex.ts | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/lib/mangadex.ts b/src/lib/mangadex.ts index 9ab65d75..f6b6b407 100644 --- a/src/lib/mangadex.ts +++ b/src/lib/mangadex.ts @@ -36,17 +36,7 @@ export const chapterCount = async (manga: Media): Promise<number | null> => { return null; } - let lastChapterIndex = 0; - - 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']; + let lastChapter = lastChapterData['data'][0]['attributes']['chapter']; if (lastChapter == 0) { lastChapter = null; @@ -54,8 +44,8 @@ export const chapterCount = async (manga: Media): Promise<number | null> => { await chapterDatabase.chapters.put({ id: manga.id, - chapters: lastChapter + chapters: Number(lastChapter) }); - return lastChapter; + return Number(lastChapter); }; |