From ae44def45bfec163ef698c9c6cd301d266a604d1 Mon Sep 17 00:00:00 2001 From: zjamnik Date: Wed, 6 Jul 2022 18:47:20 +0200 Subject: [PATCH] max volume calculation fix --- WNtoEmail.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/WNtoEmail.js b/WNtoEmail.js index 3dc887b..2d7268c 100644 --- a/WNtoEmail.js +++ b/WNtoEmail.js @@ -354,8 +354,9 @@ async function main() { let startVol = novel['lastVolume']; let totalChapters = chapters.length; - const maxVolume = novel['completed'] ? startVol + 1 + Math.floor(totalChapters / novel['completedVolumeChapterCount']) : startVol + Math.floor(totalChapters / novel['completedVolumeChapterCount']); - const maxVolLen = (novel['completed'] ? maxVolume : maxVolume + Math.floor((chapters.length - (maxVolume + novel['completedVolumeChapterCount'])) / novel['volumeChapterCount'])).toString().length; + const maxVolume = novel['completed'] ? startVol + Math.ceil(totalChapters / novel['completedVolumeChapterCount']) : startVol + Math.floor(totalChapters / novel['completedVolumeChapterCount']); + const maxVolLen = (novel['completed'] ? maxVolume : + maxVolume + Math.floor((chapters.length - (maxVolume * novel['completedVolumeChapterCount'])) / novel['volumeChapterCount'])).toString().length; let ebookAttachments = [];