Set now as last updated for manga if the source does not provide a date for new chapters

This commit is contained in:
Jay 2020-02-08 04:41:24 -08:00
parent 750c515db8
commit fee697f148

View File

@ -136,7 +136,11 @@ fun syncChaptersWithSource(db: DatabaseHelper,
// Set this manga as updated since chapters were changed
val newestChatper = db.getChapters(manga).executeAsBlocking().maxBy { it.date_upload }
val dateFetch = newestChatper?.date_upload ?: manga.last_update
manga.last_update = dateFetch
if (dateFetch == 0L) {
if (toAdd.isNotEmpty())
manga.last_update = Date().time
}
else manga.last_update = dateFetch
db.updateLastUpdated(manga).executeAsBlocking()
}