Fix tracker duplicates

pull/26/head
Koitharu 5 years ago
parent c54d128c09
commit 9a0b7c4700

@ -28,13 +28,14 @@ class TrackingRepository(
} }
val tracks = db.tracksDao.findAll().groupBy { it.mangaId } val tracks = db.tracksDao.findAll().groupBy { it.mangaId }
return mangaList return mangaList
.distinctBy { it.id } .mapNotNull {
.mapNotNull { me -> if (it.source == MangaSource.LOCAL) {
val manga = if (me.source == MangaSource.LOCAL) { localMangaRepository.getRemoteManga(it)
localMangaRepository.getRemoteManga(me) // FIXME duplicating
} else { } else {
me it
} ?: return@mapNotNull null }
}.distinctBy { it.id }
.map { manga ->
val track = tracks[manga.id]?.singleOrNull() val track = tracks[manga.id]?.singleOrNull()
MangaTracking( MangaTracking(
manga = manga, manga = manga,

Loading…
Cancel
Save