Fix showing/hide read items crash

This commit is contained in:
Shinokuni 2021-07-01 22:17:59 +02:00
parent 15596e5fff
commit d600633aca
1 changed files with 7 additions and 5 deletions

View File

@ -53,12 +53,14 @@ object ItemsQueryBuilder {
} }
private fun buildWhereClause(queryFilters: QueryFilters, separateState: Boolean): String = StringBuilder(500).run { private fun buildWhereClause(queryFilters: QueryFilters, separateState: Boolean): String = StringBuilder(500).run {
if (separateState) append("Feed.account_id = ${queryFilters.accountId} And ")
append("ItemState.account_id = ${queryFilters.accountId} And ")
else
append("Feed.account_id = ${queryFilters.accountId} And ")
if (!queryFilters.showReadItems) append("ItemState.read = 0 And ") if (!queryFilters.showReadItems) {
if (separateState)
append("ItemState.read = 0 And ")
else
append("Item.read = 0 And ")
}
when (queryFilters.filterType) { when (queryFilters.filterType) {
FilterType.FEED_FILTER -> append("feed_id = ${queryFilters.filterFeedId} And read_it_later = 0") FilterType.FEED_FILTER -> append("feed_id = ${queryFilters.filterFeedId} And read_it_later = 0")