Allow offline filtering #75

Merged
AmineB merged 6 commits from davidoskky/ReaderForSelfoss-multiplatform:offline_filters into master 2022-10-14 07:18:43 +00:00
Contributor

Types of changes

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • This is NOT translation related.

This closes issue #58

Also fixed the database was storing the article title in place of the source title.

## Types of changes - [x] I have read the **CONTRIBUTING** document. - [x] My code follows the code style of this project. - [ ] I have updated the documentation accordingly. - [x] I have added tests to cover my changes. - [x] All new and existing tests passed. - [x] This is **NOT** translation related. This closes issue #58 Also fixed the database was storing the article title in place of the source title.
davidoskky added 3 commits 2022-10-08 15:17:54 +00:00
AmineB requested changes 2022-10-10 18:27:18 +00:00
@ -71,6 +71,10 @@ class Repository(private val api: SelfossApi, private val appSettingsService: Ap
displayedItems == ItemType.ALL ||
Owner

This should be something like this.

                    val dbItems = getDBItems().filter {
                        displayedItems == ItemType.ALL ||
                                (it.unread && displayedItems == ItemType.UNREAD) ||
                                (it.starred && displayedItems == ItemType.STARRED)
                    }
                    if (tagFilter != null) {
                        dbItems = dbItems.filter {
                            tagFilter == null || it.tags.contains(tagFilter!!.tag)
                        }
                    }
                    if (sourceFilter!= null) {
                        dbItems = dbItems.filter {
                            sourceFilter == null || it.sourcetitle == sourceFilter!!.title
                        }
                    }
                    return dbItems.map { it.toView() }
This should be something like this. ``` val dbItems = getDBItems().filter { displayedItems == ItemType.ALL || (it.unread && displayedItems == ItemType.UNREAD) || (it.starred && displayedItems == ItemType.STARRED) } if (tagFilter != null) { dbItems = dbItems.filter { tagFilter == null || it.tags.contains(tagFilter!!.tag) } } if (sourceFilter!= null) { dbItems = dbItems.filter { sourceFilter == null || it.sourcetitle == sourceFilter!!.title } } return dbItems.map { it.toView() } ```
davidoskky added 1 commit 2022-10-10 22:52:16 +00:00
Rearrange filtering steps
All checks were successful
continuous-integration/drone/pr Build is passing
02098a7aa9
davidoskky requested review from AmineB 2022-10-12 22:09:41 +00:00
AmineB requested changes 2022-10-13 18:27:44 +00:00
@ -69,0 +72,4 @@
(it.starred && displayedItems == ItemType.STARRED)
}
if (tagFilter != null) {
dbItems.filter { it.tags.contains(tagFilter!!.tag) }
Owner

This should be dbItems = dbItems.filter { it.tags.contains(tagFilter!!.tag) } (with dbItems being a var). Else, it does not filter anything.

This should be `dbItems = dbItems.filter { it.tags.contains(tagFilter!!.tag) }` (with `dbItems` being a var). Else, it does not filter anything.
@ -69,0 +75,4 @@
dbItems.filter { it.tags.contains(tagFilter!!.tag) }
}
if (sourceFilter != null) {
dbItems.filter { it.sourcetitle == sourceFilter!!.title }
Owner

This should be dbItems = dbItems.filter { it.tags.contains(tagFilter!!.tag) } (with dbItems being a var). Else, it does not filter anything.

This should be `dbItems = dbItems.filter { it.tags.contains(tagFilter!!.tag) }` (with `dbItems` being a var). Else, it does not filter anything.
Author
Contributor

Right... I didn't write the tests correctly and assumed that worked...

Right... I didn't write the tests correctly and assumed that worked...
davidoskky added 2 commits 2022-10-13 22:10:43 +00:00
Actually filter database items
All checks were successful
continuous-integration/drone/pr Build is passing
8bfe14c019
AmineB merged commit 8b0bbe71c9 into master 2022-10-14 07:18:43 +00:00
davidoskky deleted branch offline_filters 2022-10-14 07:19:57 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Louvorg/ReaderForSelfoss-multiplatform#75
No description provided.