Skip to content

Commit

Permalink
Handle disabled download ahead limit for new chapters auto download (#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
schroda authored Oct 29, 2023
1 parent 912c340 commit 616ed46
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 616ed46

Please sign in to comment.