Fix chapter source order not working correctly and allow refresh to update source order
Based on 00f916a4f0
Co-authored-by: CarlosEsco <CarlosEsco@users.noreply.github.com>
(cherry picked from commit 07e5525c7433914f8e4b7dad03eb3081e622df48)
This commit is contained in:
parent
6323306693
commit
811be77144
@ -75,6 +75,7 @@ fun syncChaptersWithSource(
|
||||
dbChapter.name = sourceChapter.name
|
||||
dbChapter.date_upload = sourceChapter.date_upload
|
||||
dbChapter.chapter_number = sourceChapter.chapter_number
|
||||
dbChapter.source_order = sourceChapter.source_order
|
||||
toChange.add(dbChapter)
|
||||
}
|
||||
}
|
||||
@ -174,7 +175,9 @@ fun syncChaptersWithSource(
|
||||
db.insertChapters(toChange).executeAsBlocking()
|
||||
}
|
||||
|
||||
val topChapters = db.getChapters(manga).executeAsBlocking().sortedByDescending { it.date_upload }.take(4)
|
||||
val topChapters = db.getChapters(manga).executeAsBlocking()
|
||||
.sortedByDescending { it.date_upload }
|
||||
.take(4)
|
||||
// Recalculate next update since chapters were changed
|
||||
if (topChapters.size > 1) {
|
||||
var delta = 0L
|
||||
@ -203,11 +206,11 @@ fun syncChaptersWithSource(
|
||||
return Pair(toAdd.subtract(readded).toList(), toDelete.subtract(readded).toList())
|
||||
}
|
||||
|
||||
// checks if the chapter in db needs updated
|
||||
private fun shouldUpdateDbChapter(dbChapter: Chapter, sourceChapter: SChapter): Boolean {
|
||||
private fun shouldUpdateDbChapter(dbChapter: Chapter, sourceChapter: Chapter): Boolean {
|
||||
return dbChapter.scanlator != sourceChapter.scanlator || dbChapter.name != sourceChapter.name ||
|
||||
dbChapter.date_upload != sourceChapter.date_upload ||
|
||||
dbChapter.chapter_number != sourceChapter.chapter_number
|
||||
dbChapter.chapter_number != sourceChapter.chapter_number ||
|
||||
dbChapter.source_order != sourceChapter.source_order
|
||||
}
|
||||
|
||||
class NoChaptersException : Exception()
|
||||
|
Loading…
x
Reference in New Issue
Block a user