aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/List/Due/MangaList.svelte5
-rw-r--r--src/routes/settings/+page.svelte16
-rw-r--r--src/stores/roundDownChapters.ts14
3 files changed, 30 insertions, 5 deletions
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;
diff --git a/src/routes/settings/+page.svelte b/src/routes/settings/+page.svelte
index f7b64296..32ecfed8 100644
--- a/src/routes/settings/+page.svelte
+++ b/src/routes/settings/+page.svelte
@@ -5,10 +5,12 @@
import { chapterDatabase } from '$lib/chapterDatabase';
import cacheMangaMinutes from '../../stores/cacheMangaMinutes';
import cacheMinutes from '../../stores/cacheMinutes';
+ import roundDownChapters from '../../stores/roundDownChapters';
export let data;
$: displayingUnresolved = $displayUnresolved === 'true';
+ $: roundingDownChapters = $roundDownChapters === 'true';
$: mangaClosed = $closeMangaByDefault === 'true';
$: animeClosed = $closeAnimeByDefault === 'true';
@@ -44,13 +46,17 @@
displayingUnresolved ? displayUnresolved.set('false') : displayUnresolved.set('true')}
>{displayingUnresolved ? 'Hide' : 'Show'} unresolved</a
>
+ <small style="opacity: 50%;">Displays unresolved chapter counts as "?"</small>
</li>
<li>
- <a href="#" on:click={pruneUnresolved}
- >Prune <b>ALL</b> cached, unresolved manga (for instant re-cache)</a
+ <a
+ href="#"
+ on:click={() =>
+ roundingDownChapters ? roundDownChapters.set('false') : roundDownChapters.set('true')}
+ >{roundingDownChapters ? 'Round down' : 'Maintain'} chapters</a
>
+ <small style="opacity: 50%;">50/50.6 would <b>not</b> be due</small>
</li>
- <li><a href="#" on:click={pruneAll}>Prune <b>ALL</b> cached manga</a></li>
<li>
<a
href="#"
@@ -68,6 +74,10 @@
>
</li>
<li>
+ <a href="#" on:click={pruneUnresolved}>Re-cache <b>ALL</b> unresolved manga</a>
+ </li>
+ <li><a href="#" on:click={pruneAll}>Re-cache <b>ALL</b> manga</a></li>
+ <li>
Re-cache <b>ALL</b> media keys every <input type="number" bind:value={$cacheMinutes} /> minutes
</li>
<li>
diff --git a/src/stores/roundDownChapters.ts b/src/stores/roundDownChapters.ts
new file mode 100644
index 00000000..f4ac3513
--- /dev/null
+++ b/src/stores/roundDownChapters.ts
@@ -0,0 +1,14 @@
+import { browser } from '$app/environment';
+import { writable } from 'svelte/store';
+
+const roundDownChapters = writable<string>(
+ browser ? localStorage.getItem('roundDownChapters') ?? 'false' : 'false'
+);
+
+roundDownChapters.subscribe((value) => {
+ if (browser) {
+ localStorage.setItem('roundDownChapters', value);
+ }
+});
+
+export default roundDownChapters;