From 64e06b29661de0bccc5eadc8f16400340f5cc270 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Sat, 11 Jan 2025 13:58:46 +0100 Subject: [PATCH] Handle ".5" chapters as full chapter numbers for missing chapter detection Chapter numbers can change from e.g. "1" to "2.1" and in that case missing chapters were detected. However, with these weird chapter numbers it's not clear if a chapter is actually missing or not, thus, they should not cause a missing chapter warning --- src/modules/reader/services/ReaderControls.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/modules/reader/services/ReaderControls.ts b/src/modules/reader/services/ReaderControls.ts index b69da746..67ee34df 100644 --- a/src/modules/reader/services/ReaderControls.ts +++ b/src/modules/reader/services/ReaderControls.ts @@ -230,10 +230,13 @@ export class ReaderControls { return; } - const missingChapters = Math.abs(currentChapter.chapterNumber - chapterToOpen.chapterNumber); + const missingChapters = Math.max( + 0, + Math.trunc(currentChapter.chapterNumber) - Math.trunc(chapterToOpen.chapterNumber) - 1, + ); const isSameScanlator = !shouldInformAboutScanlatorChange || currentChapter.scanlator === chapterToOpen.scanlator; - const isContinuousChapter = !shouldInformAboutMissingChapter || missingChapters <= 1; + const isContinuousChapter = !shouldInformAboutMissingChapter || !missingChapters; const showWarning = !isSameScanlator || !isContinuousChapter; if (!showWarning) { @@ -260,7 +263,7 @@ export class ReaderControls { const continuousChapter = isContinuousChapter ? '' : t(offsetToTranslationKeys[offset].chapter_number, { - count: missingChapters - 1, + count: missingChapters, nextChapter: `#${chapterToOpen.chapterNumber} ${chapterToOpen.name}`, currentChapter: `#${currentChapter.chapterNumber} ${currentChapter.name}`, });