Fix ETA history duration mapping for library compile
Some checks failed
Forgejo Release Builder / release (push) Failing after 7m34s
Some checks failed
Forgejo Release Builder / release (push) Failing after 7m34s
This commit is contained in:
parent
e301ee2574
commit
25137641c1
2 changed files with 8 additions and 8 deletions
|
|
@ -442,11 +442,9 @@ class LibraryScreenModel(
|
|||
): Map<Long, Long?> {
|
||||
if (favorites.isEmpty()) return emptyMap()
|
||||
|
||||
val chapterDurationsByMangaId = getReadDurationEntriesByMangaIds.await(
|
||||
favorites.map { it.id },
|
||||
)
|
||||
.groupBy { it.mangaId }
|
||||
.mapValues { (_, entries) -> entries.map { it.readDuration } }
|
||||
val chapterDurationsByMangaId = favorites.associate { item ->
|
||||
item.id to getReadDurationEntriesByMangaIds.await(item.id).map { it.readDuration }
|
||||
}
|
||||
val globalAverageChapterDurationMs = calculateAverageChapterDurationMs(
|
||||
chapterDurationsByMangaId.values.flatten(),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -6,9 +6,11 @@ import tachiyomi.domain.history.repository.HistoryRepository
|
|||
class GetReadDurationEntriesByMangaIds(
|
||||
private val repository: HistoryRepository,
|
||||
) {
|
||||
suspend fun await(mangaId: Long): List<History> {
|
||||
return repository.getHistoryByMangaId(mangaId)
|
||||
}
|
||||
|
||||
suspend fun await(mangaIds: List<Long>): List<History> {
|
||||
return mangaIds.flatMap { mangaId ->
|
||||
repository.getHistoryByMangaId(mangaId)
|
||||
}
|
||||
return mangaIds.flatMap(::await)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue