mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-05 01:15:14 +01:00
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>
This commit is contained in:
parent
776194f5b2
commit
07e5525c74
@ -74,6 +74,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)
|
||||
}
|
||||
}
|
||||
@ -158,7 +159,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
|
||||
@ -187,11 +190,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…
Reference in New Issue
Block a user