Prevent negative lastPageRead values (#1267)

Co-authored-by: Mitchell Syer <Syer10@users.noreply.github.com>
This commit is contained in:
schroda
2025-02-15 01:06:54 +01:00
committed by GitHub
parent 733ba16af2
commit c8bd39b4bf
4 changed files with 28 additions and 5 deletions

View File

@@ -85,7 +85,7 @@ class ChapterMutation {
this[ChapterTable.isBookmarked] = it
}
patch.lastPageRead?.also {
this[ChapterTable.lastPageRead] = it.coerceAtMost(chapterIdToPageCount[chapterId] ?: 0).coerceAtLeast(0)
this[ChapterTable.lastPageRead] = it.coerceIn(0, chapterIdToPageCount[chapterId])
this[ChapterTable.lastReadAt] = now
}
}