Add a query to get the next unread chapter
This commit is contained in:
parent
665eb232a7
commit
382acab118
1 changed files with 15 additions and 0 deletions
|
@ -226,6 +226,21 @@ public class DatabaseHelper {
|
|||
.prepare();
|
||||
}
|
||||
|
||||
public PreparedGetListOfObjects<Chapter> getNextUnreadChapter(Manga manga) {
|
||||
return db.get()
|
||||
.listOfObjects(Chapter.class)
|
||||
.withQuery(Query.builder()
|
||||
.table(ChapterTable.TABLE)
|
||||
.where(ChapterTable.COLUMN_MANGA_ID + "=? AND " +
|
||||
ChapterTable.COLUMN_READ + "=? AND " +
|
||||
ChapterTable.COLUMN_CHAPTER_NUMBER + ">=?")
|
||||
.whereArgs(manga.id, 0, 0)
|
||||
.orderBy(ChapterTable.COLUMN_CHAPTER_NUMBER)
|
||||
.limit(1)
|
||||
.build())
|
||||
.prepare();
|
||||
}
|
||||
|
||||
public PreparedPutObject<Chapter> insertChapter(Chapter chapter) {
|
||||
return db.put()
|
||||
.object(chapter)
|
||||
|
|
Reference in a new issue