fix(updates): Fix wrong date order (#963)

This commit is contained in:
Cuong-Tran 2025-05-31 11:30:15 +07:00 committed by GitHub
parent 2d05584fea
commit 89f0e240ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -99,12 +99,15 @@ class UpdatesScreenModel(
isLoading = false,
items = updates.toUpdateItems()
// KMK -->
.groupBy { it.update.mangaId }
.values
.flatMap { mangaChapters ->
val (unread, read) = mangaChapters.partition { !it.update.read }
unread.sortedBy { it.update.dateFetch } +
read.sortedByDescending { it.update.dateFetch }
.groupBy { it.update.dateFetch.toLocalDate() }
.flatMap { (_, mangas) ->
mangas.groupBy { it.update.mangaId }
.values
.flatMap { mangaChapters ->
val (unread, read) = mangaChapters.partition { !it.update.read }
unread.sortedBy { it.update.dateFetch } +
read.sortedByDescending { it.update.dateFetch }
}
}
.toPersistentList(),
// KMK <--