aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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({