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?> {
|
): Map<Long, Long?> {
|
||||||
if (favorites.isEmpty()) return emptyMap()
|
if (favorites.isEmpty()) return emptyMap()
|
||||||
|
|
||||||
val chapterDurationsByMangaId = getReadDurationEntriesByMangaIds.await(
|
val chapterDurationsByMangaId = favorites.associate { item ->
|
||||||
favorites.map { it.id },
|
item.id to getReadDurationEntriesByMangaIds.await(item.id).map { it.readDuration }
|
||||||
)
|
}
|
||||||
.groupBy { it.mangaId }
|
|
||||||
.mapValues { (_, entries) -> entries.map { it.readDuration } }
|
|
||||||
val globalAverageChapterDurationMs = calculateAverageChapterDurationMs(
|
val globalAverageChapterDurationMs = calculateAverageChapterDurationMs(
|
||||||
chapterDurationsByMangaId.values.flatten(),
|
chapterDurationsByMangaId.values.flatten(),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,11 @@ import tachiyomi.domain.history.repository.HistoryRepository
|
||||||
class GetReadDurationEntriesByMangaIds(
|
class GetReadDurationEntriesByMangaIds(
|
||||||
private val repository: HistoryRepository,
|
private val repository: HistoryRepository,
|
||||||
) {
|
) {
|
||||||
|
suspend fun await(mangaId: Long): List<History> {
|
||||||
|
return repository.getHistoryByMangaId(mangaId)
|
||||||
|
}
|
||||||
|
|
||||||
suspend fun await(mangaIds: List<Long>): List<History> {
|
suspend fun await(mangaIds: List<Long>): List<History> {
|
||||||
return mangaIds.flatMap { mangaId ->
|
return mangaIds.flatMap(::await)
|
||||||
repository.getHistoryByMangaId(mangaId)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue