Handle disabled download ahead limit for new chapters auto download (#734)

In case download ahead is disabled, all new chapters should get downloaded.
Due to incorrectly calculating the index of the first new chapter to download, no new chapter was downloaded at all
This commit is contained in:
schroda
2023-10-29 16:02:02 +01:00
committed by GitHub
parent 912c340a01
commit 616ed4637d
@@ -243,7 +243,11 @@ object Chapter {
}
val firstChapterToDownloadIndex =
(numberOfNewChapters - serverConfig.autoDownloadAheadLimit.value).coerceAtLeast(0)
if (serverConfig.autoDownloadAheadLimit.value > 0) {
(numberOfNewChapters - serverConfig.autoDownloadAheadLimit.value).coerceAtLeast(0)
} else {
0
}
val chapterIdsToDownload =
newChapters.subList(firstChapterToDownloadIndex, numberOfNewChapters)