From ee8a53188c77d60b8105d1e6dcaedf35c2260ec8 Mon Sep 17 00:00:00 2001 From: Jay Date: Fri, 10 Jan 2020 23:47:02 -0800 Subject: [PATCH] Set manga last update field based on chapter fetch time (closes #2217) Based on https://github.com/Jays2Kings/tachiyomiJ2K/commit/3c81f60041b0aaf638ea9a128bfeb00cd818c18b#diff-7e5179d048c3dfaf75b444b7277fc840 --- .../main/java/eu/kanade/tachiyomi/util/ChapterSourceSync.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/ChapterSourceSync.kt b/app/src/main/java/eu/kanade/tachiyomi/util/ChapterSourceSync.kt index 0b9bbd97fe..c237110fd7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/ChapterSourceSync.kt +++ b/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() }