mirror of
https://github.com/gotson/komga.git
synced 2025-12-20 07:23:34 +01:00
fix(api): add maxNumberSort to TachiyomiReadProgressV2Dto.kt
This commit is contained in:
parent
102484ae80
commit
5e9cb43710
2 changed files with 10 additions and 2 deletions
|
|
@ -58,9 +58,15 @@ class ReadProgressDtoDao(
|
|||
.fetch()
|
||||
.toList()
|
||||
|
||||
val maxNumberSort = dsl.select(DSL.max(d.NUMBER_SORT))
|
||||
.from(b)
|
||||
.leftJoin(d).on(b.ID.eq(d.BOOK_ID))
|
||||
.where(b.SERIES_ID.eq(seriesId))
|
||||
.fetchOne(DSL.max(d.NUMBER_SORT)) ?: 0F
|
||||
|
||||
val booksCount = getSeriesBooksCount(seriesId, userId)
|
||||
|
||||
return booksCountToDtoV2(booksCount, numberSortReadProgress.lastRead() ?: 0F)
|
||||
return booksCountToDtoV2(booksCount, numberSortReadProgress.lastRead() ?: 0F, maxNumberSort)
|
||||
}
|
||||
|
||||
private fun getSeriesBooksCount(seriesId: String, userId: String) = dsl
|
||||
|
|
@ -122,13 +128,14 @@ class ReadProgressDtoDao(
|
|||
lastReadContinuousIndex = lastReadContinuousIndex,
|
||||
)
|
||||
|
||||
private fun booksCountToDtoV2(booksCount: BooksCount, lastReadContinuousNumberSort: Float): TachiyomiReadProgressV2Dto =
|
||||
private fun booksCountToDtoV2(booksCount: BooksCount, lastReadContinuousNumberSort: Float, maxNumberSort: Float): TachiyomiReadProgressV2Dto =
|
||||
TachiyomiReadProgressV2Dto(
|
||||
booksCount = booksCount.totalCount,
|
||||
booksUnreadCount = booksCount.unreadCount,
|
||||
booksInProgressCount = booksCount.inProgressCount,
|
||||
booksReadCount = booksCount.readCount,
|
||||
lastReadContinuousNumberSort = lastReadContinuousNumberSort,
|
||||
maxNumberSort = maxNumberSort,
|
||||
)
|
||||
|
||||
private fun readProgressCondition(userId: String): Condition = r.USER_ID.eq(userId).or(r.USER_ID.isNull)
|
||||
|
|
|
|||
|
|
@ -6,4 +6,5 @@ data class TachiyomiReadProgressV2Dto(
|
|||
val booksUnreadCount: Int,
|
||||
val booksInProgressCount: Int,
|
||||
val lastReadContinuousNumberSort: Float,
|
||||
val maxNumberSort: Float,
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue