Skip to content

Commit

Permalink
fix: potential incorrect read progress for series
Browse files Browse the repository at this point in the history
  • Loading branch information
gotson committed Aug 27, 2020
1 parent dfa6ad0 commit 7b90244
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,19 @@ class SeriesDtoDao(
.from(s)
.leftJoin(b).on(s.ID.eq(b.SERIES_ID))
.leftJoin(d).on(s.ID.eq(d.SERIES_ID))
.leftJoin(r).on(b.ID.eq(r.BOOK_ID))
.leftJoin(r).on(b.ID.eq(r.BOOK_ID)).and(readProgressCondition(userId))
.leftJoin(g).on(s.ID.eq(g.SERIES_ID))
.leftJoin(st).on(s.ID.eq(st.SERIES_ID))
.and(readProgressCondition(userId))
.leftJoin(cs).on(s.ID.eq(cs.SERIES_ID))

private fun findAll(conditions: Condition, having: Condition, userId: String, pageable: Pageable, selectCollectionNumber: Boolean = false): Page<SeriesDto> {
val count = dsl.selectDistinct(s.ID)
.from(s)
.leftJoin(b).on(s.ID.eq(b.SERIES_ID))
.leftJoin(d).on(s.ID.eq(d.SERIES_ID))
.leftJoin(r).on(b.ID.eq(r.BOOK_ID))
.leftJoin(r).on(b.ID.eq(r.BOOK_ID)).and(readProgressCondition(userId))
.leftJoin(g).on(s.ID.eq(g.SERIES_ID))
.leftJoin(st).on(s.ID.eq(st.SERIES_ID))
.and(readProgressCondition(userId))
.leftJoin(cs).on(s.ID.eq(cs.SERIES_ID))
.where(conditions)
.groupBy(s.ID)
Expand Down Expand Up @@ -159,8 +157,7 @@ class SeriesDtoDao(
.select(countRead.`as`(BOOKS_READ_COUNT))
.select(countInProgress.`as`(BOOKS_IN_PROGRESS_COUNT))
.from(b)
.leftJoin(r).on(b.ID.eq(r.BOOK_ID))
.and(readProgressCondition(userId))
.leftJoin(r).on(b.ID.eq(r.BOOK_ID)).and(readProgressCondition(userId))
.where(b.SERIES_ID.eq(sr.id))
.fetch()
.first()
Expand Down

0 comments on commit 7b90244

Please sign in to comment.