From 585bc0cb4993323c855cf4112491b5c55bfcd611 Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Sun, 27 Aug 2023 17:40:50 -0700
Subject: feat(manga): chapter rounding

---
 src/lib/List/Due/MangaList.svelte | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'src/lib/List/Due/MangaList.svelte')

diff --git a/src/lib/List/Due/MangaList.svelte b/src/lib/List/Due/MangaList.svelte
index 91524bdc..113d4017 100644
--- a/src/lib/List/Due/MangaList.svelte
+++ b/src/lib/List/Due/MangaList.svelte
@@ -7,6 +7,7 @@
 	import manga from '../../../stores/manga';
 	import { chapterDatabase } from '$lib/chapterDatabase';
 	import cacheMangaMinutes from '../../../stores/cacheMangaMinutes';
+	import roundDownChapters from '../../../stores/roundDownChapters';
 
 	export let user: AniListAuthorisation;
 	export let identity: UserIdentity;
@@ -34,7 +35,6 @@
 				Number($cacheMangaMinutes)
 			) {
 				const unresolved = await chapterDatabase.chapters.where('chapters').equals(-1).toArray();
-
 				const ids = unresolved.map((m) => m.id);
 
 				chaptersLastPrune.set(new Date().getTime().toString());
@@ -77,7 +77,8 @@
 				}) === index &&
 				(item.episodes === null && displayUnresolved
 					? true
-					: (item.mediaListEntry?.progress || 0) < item.episodes)
+					: (item.mediaListEntry?.progress || 0) <
+					  ($roundDownChapters === 'true' ? Math.floor(item.episodes) : item.episodes))
 			);
 		});
 		endTime = performance.now() - startTime;
-- 
cgit v1.2.3

