Rearrange filtering steps
All checks were successful
continuous-integration/drone/pr Build is passing
All checks were successful
continuous-integration/drone/pr Build is passing
This commit is contained in:
parent
d0a982f385
commit
02098a7aa9
@ -66,16 +66,19 @@ class Repository(private val api: SelfossApi, private val appSettingsService: Ap
|
|||||||
} else {
|
} else {
|
||||||
if (appSettingsService.isItemCachingEnabled()) {
|
if (appSettingsService.isItemCachingEnabled()) {
|
||||||
fromDB = true
|
fromDB = true
|
||||||
fetchedItems = SelfossModel.StatusAndData.succes(
|
val dbItems = getDBItems().filter {
|
||||||
getDBItems().filter {
|
|
||||||
displayedItems == ItemType.ALL ||
|
displayedItems == ItemType.ALL ||
|
||||||
(it.unread && displayedItems == ItemType.UNREAD) ||
|
(it.unread && displayedItems == ItemType.UNREAD) ||
|
||||||
(it.starred && displayedItems == ItemType.STARRED)
|
(it.starred && displayedItems == ItemType.STARRED)
|
||||||
}.filter {
|
}
|
||||||
tagFilter == null || it.tags.contains(tagFilter!!.tag)
|
if (tagFilter != null) {
|
||||||
}.filter {
|
dbItems.filter { it.tags.contains(tagFilter!!.tag) }
|
||||||
sourceFilter == null || it.sourcetitle == sourceFilter!!.title
|
}
|
||||||
}.map { it.toView() }
|
if (sourceFilter != null) {
|
||||||
|
dbItems.filter { it.sourcetitle == sourceFilter!!.title }
|
||||||
|
}
|
||||||
|
fetchedItems = SelfossModel.StatusAndData.succes(
|
||||||
|
dbItems.map { it.toView() }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user