Probably fix previously read exh chapters affect updated gallery chapters
This commit is contained in:
parent
1fdbae5bf8
commit
ea620a8c74
@ -86,12 +86,12 @@ interface ChapterQueries : DbProvider {
|
|||||||
)
|
)
|
||||||
.prepare()
|
.prepare()
|
||||||
|
|
||||||
fun getChaptersReadWithUrls(urls: List<String>) = db.get()
|
fun getChaptersReadByUrls(urls: List<String>) = db.get()
|
||||||
.listOfObjects(Chapter::class.java)
|
.listOfObjects(Chapter::class.java)
|
||||||
.withQuery(
|
.withQuery(
|
||||||
Query.builder()
|
Query.builder()
|
||||||
.table(ChapterTable.TABLE)
|
.table(ChapterTable.TABLE)
|
||||||
.where("${ChapterTable.COL_URL} IN (?) AND ${ChapterTable.COL_READ} = 1")
|
.where("${ChapterTable.COL_URL} IN (?) AND (${ChapterTable.COL_READ} = 1 OR ${ChapterTable.COL_LAST_PAGE_READ} != 0)")
|
||||||
.whereArgs(urls.joinToString { "\"$it\"" })
|
.whereArgs(urls.joinToString { "\"$it\"" })
|
||||||
.build()
|
.build()
|
||||||
)
|
)
|
||||||
|
@ -145,12 +145,13 @@ fun syncChaptersWithSource(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (readded.isEmpty() && !DebugToggles.INCLUDE_ONLY_ROOT_WHEN_LOADING_EXH_VERSIONS.enabled) {
|
if (dbChapters.isEmpty() && !DebugToggles.INCLUDE_ONLY_ROOT_WHEN_LOADING_EXH_VERSIONS.enabled) {
|
||||||
val readChapters = db.getChaptersReadWithUrls(finalAdded.map { it.url }).executeAsBlocking()
|
val readChapters = db.getChaptersReadByUrls(finalAdded.map { it.url }).executeAsBlocking()
|
||||||
|
val readChapterUrls = readChapters.map { it.url }
|
||||||
if (readChapters.isNotEmpty()) {
|
if (readChapters.isNotEmpty()) {
|
||||||
finalAdded.onEach { chapter ->
|
toAdd.filter { it.url in readChapterUrls }.onEach { chapter ->
|
||||||
readChapters.firstOrNull { it.url == chapter.url }?.let {
|
readChapters.firstOrNull { it.url == chapter.url }?.let {
|
||||||
chapter.read = true
|
chapter.read = it.read
|
||||||
chapter.last_page_read = it.last_page_read
|
chapter.last_page_read = it.last_page_read
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user