Syrius: Some proposals not displaying when "Only accepted" is toggled

I did some research in this bug and found the cause.

Problem

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.

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.

Implementation: https://github.com/KingGorrin/syrius/tree/fix-az-list

Questions

  1. 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.

  2. 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.

4 Likes

Yes, I noticed the logic for the proposals didn’t produce expected results if both checkboxes were ticked (i.e. double filtering).

I can post my atomic swap checkbox logic, if you want to compare.

Maybe we hide the checkboxes if a selected address isn’t a pillar. Easy change via Visibility widget. Let me know if you want assistance.

I pushed my solution to the fix-az-list branch.

The filter needs to be inclusive.

The filter tags still make sense when implemented this way. For example for completed or rejected projects.

1 Like

You can open a PR and I’ll merge it if it’s tested and works.

On which repository should the PR be issued exactly?

I’ll merge it here and will be available in Syrius v0.0.6.

1 Like

Great, I’ve created the two PR’s.

Both PRs are merged, thank you!

3 Likes

I will test on mac again today.

1 Like

OP correction.

What?

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?

  1. 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.

Implementation

https://github.com/KingGorrin/syrius/tree/fix-az-list

1 Like