mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-17 11:59:19 +01:00
Add a query to get the next unread chapter
This commit is contained in:
parent
665eb232a7
commit
382acab118
@ -226,6 +226,21 @@ public class DatabaseHelper {
|
|||||||
.prepare();
|
.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) {
|
public PreparedPutObject<Chapter> insertChapter(Chapter chapter) {
|
||||||
return db.put()
|
return db.put()
|
||||||
.object(chapter)
|
.object(chapter)
|
||||||
|
Loading…
Reference in New Issue
Block a user