Bläddra i källkod

Set manga last update field based on chapter fetch time (closes #2217)

Based on https://github.com/Jays2Kings/tachiyomiJ2K/commit/3c81f60041b0aaf638ea9a128bfeb00cd818c18b#diff-7e5179d048c3dfaf75b444b7277fc840
Jay 5 år sedan
förälder
incheckning
ee8a53188c
1 ändrade filer med 3 tillägg och 2 borttagningar
  1. 3 2
      app/src/main/java/eu/kanade/tachiyomi/util/ChapterSourceSync.kt

+ 3 - 2
app/src/main/java/eu/kanade/tachiyomi/util/ChapterSourceSync.kt

@@ -128,8 +128,9 @@ fun syncChaptersWithSource(db: DatabaseHelper,
         // Fix order in source.
         db.fixChaptersSourceOrder(sourceChapters).executeAsBlocking()
 
-        // Set this manga as updated since chapters were changed
-        manga.last_update = Date().time
+        // Set manga's last update time to latest chapter's fetch time if possible
+        val newestChapter = db.getChapters(manga).executeAsBlocking().maxBy { it.date_fetch }
+        manga.last_update = newestChapter?.date_fetch ?: manga.last_update
         db.updateLastUpdated(manga).executeAsBlocking()
     }