When no search term is used, the getAll(pageIndex, pageSize) paging method is used. The paging variables are supplied by the infinite_scroll_bloc.
The infinite_scroll_bloc uses a static pageSize of 10.
The getAll method returns 10 project, 6 of which are rejected or completed. The user applies the “Only Accepted” filter which filters the initial 10 results down to 4.
The infinite_scroll_bloc checks if it has reached the last page with the following check.
final isLastPage = newItems.length < _pageSize;
Because the result was filtered down to 4, the infinite_scroll_bloc thinks it has now reached the end and shows no more results. Causing possible other accepted projects to be dropped.
In general a paging method cannot be used if filtering is applied at a later stage.
Solution
Use the getAll() non-paging method and apply paging after the search term, tag and pillar filtering.
A filter tag is not applied when it results in an empty result.
This causes strange behaviour. For example, a non pillar user with no projects. Selecting “My Projects” has no result. Selecting “My Projects” and “Only Accepted” has results.
Non pillar owners only see active or owned (based on selected address) projects.
/*
This method filters the projects according to the following rule:
if a user doesn't have a Pillar, then we only show him the active
projects
*/
This is by design but defeats the purpose of having the “My Projects” and “Only Accepted” filter tag when a user is not a pillar owner.
Incomplete results are given when filtering Accelerator Z projects without using a search term.
Why?
The bug only occures when no search term is used.
When no search term is used, the getAll(pageIndex, pageSize) paging method is used. The paging variables are supplied by the infinite_scroll_bloc.
The infinite_scroll_bloc uses a static pageSize of 10.
Example: the getAll() method returns 10 projects, 6 of which are rejected or completed. The user applies the “Only Accepted” filter and filters the initial 10 results down to 4.
The infinite_scroll_bloc checks if it has reached the last page with the following check.
final isLastPage = newItems.length < _pageSize;
Because the result was filtered down to 4, the infinite_scroll_bloc thinks it has now reached the end and shows no more results. This causes other accepted projects to be dropped.
In general a paging method cannot be used if filtering is applied at a later stage.
How?
Paging must be applied after filtering by using the getAll() non-paging method and apply paging after the search term, tag and pillar filtering.
Anything else?
A filter tag is not applied when the result is empty. This causes strange behaviour.
For example, a non pillar user with no projects. Selecting “My Projects” has no result. Selecting “My Projects” and “Only Accepted” has results. All tag filters should be inclusive.