aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-09-14 14:36:33 -0700
committerFuwn <[email protected]>2023-09-14 14:36:33 -0700
commitdddde7a7872e8422f15e5c27167d1ba4c0f62674 (patch)
tree4d51613d6fdb2bb903070caf5c402a5e4fd92d6d /src/lib
parentfeat(manga): resolve chapters from scans (diff)
downloaddue.moe-dddde7a7872e8422f15e5c27167d1ba4c0f62674.tar.xz
due.moe-dddde7a7872e8422f15e5c27167d1ba4c0f62674.zip
fix(mangadex): better estimates
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/mangadex.ts17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/lib/mangadex.ts b/src/lib/mangadex.ts
index b17a2ffa..5c73aced 100644
--- a/src/lib/mangadex.ts
+++ b/src/lib/mangadex.ts
@@ -20,21 +20,12 @@ export const chapterCount = async (
const tryRecentMediaActivities = async () => {
const anilistData = await recentMediaActivities(identity, manga);
- if (anilistData !== null) {
- await chapterDatabase.chapters.put({
- id: manga.id,
- chapters: anilistData
- });
-
- return anilistData;
- }
-
await chapterDatabase.chapters.put({
id: manga.id,
- chapters: -1
+ chapters: anilistData ? anilistData : -1
});
- return null;
+ return anilistData;
};
const mangadexData = await (
@@ -57,7 +48,7 @@ export const chapterCount = async (
let lastChapter = lastChapterData['data'][0]['attributes']['chapter'];
- if ((manga.mediaListEntry || { progress: 0 }).progress >= lastChapter) {
+ if ((manga.mediaListEntry || { progress: 0 }).progress > lastChapter) {
const anilistData = await recentMediaActivities(identity, manga);
if (anilistData !== null && anilistData > lastChapter) {
@@ -66,7 +57,7 @@ export const chapterCount = async (
}
if (lastChapter == 0) {
- lastChapter = null;
+ lastChapter = -1;
}
await chapterDatabase.chapters.put({