Skip to content

Commit

Permalink
fix: incorrect read progress for books
Browse files Browse the repository at this point in the history
read progress for books would show incorrectly, leaking from other users

closes gotson#286
  • Loading branch information
gotson committed Aug 25, 2020
1 parent 373ddd4 commit 107d7db
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,8 @@ class BookDtoDao(
.from(b)
.leftJoin(m).on(b.ID.eq(m.BOOK_ID))
.leftJoin(d).on(b.ID.eq(d.BOOK_ID))
.leftJoin(r).on(b.ID.eq(r.BOOK_ID))
.leftJoin(r).on(b.ID.eq(r.BOOK_ID)).and(readProgressCondition(userId))
.leftJoin(bt).on(b.ID.eq(bt.BOOK_ID))
.and(readProgressCondition(userId))
.leftJoin(rlb).on(b.ID.eq(rlb.BOOK_ID))
.where(conditions)
.groupBy(b.ID)
Expand Down Expand Up @@ -119,8 +118,7 @@ class BookDtoDao(
val seriesIds = dsl.select(s.ID)
.from(s)
.leftJoin(b).on(s.ID.eq(b.SERIES_ID))
.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(conditions)
.groupBy(s.ID)
.having(SeriesDtoDao.countUnread.ge(inline(1.toBigDecimal())))
Expand Down Expand Up @@ -179,9 +177,8 @@ class BookDtoDao(
.from(b)
.leftJoin(m).on(b.ID.eq(m.BOOK_ID))
.leftJoin(d).on(b.ID.eq(d.BOOK_ID))
.leftJoin(r).on(b.ID.eq(r.BOOK_ID))
.leftJoin(r).on(b.ID.eq(r.BOOK_ID)).and(readProgressCondition(userId))
.leftJoin(bt).on(b.ID.eq(bt.BOOK_ID))
.and(readProgressCondition(userId))
.leftJoin(rlb).on(b.ID.eq(rlb.BOOK_ID))

private fun ResultQuery<Record>.fetchAndMap() =
Expand Down

0 comments on commit 107d7db

Please sign in to comment.