Code4SocialGood / c4sg-web

Code for Social Good connects non-profits and open source projects with tech volunteers
http://code4socialgood.org/
MIT License
88 stars 187 forks source link

Organization list view can only filter on one check box at a time #1824

Closed emilycoleman closed 6 years ago

emilycoleman commented 6 years ago

In the organization list view, the list doesn't refresh if more than one check box has been selected.

For example: Check the "Nonprofit" check box so the list is filtered. Then check the "Has Open Projects" box and observe that nothing happens. The list will not be re-filtered until only one check box is selected.

fumba commented 6 years ago

@emilycoleman can you please verify if this issue still exists. I could not reproduce it from the steps that you provided. Thanks,

emilycoleman commented 6 years ago

@fumba On further investigation, the page behaves differently in different browsers.

Chrome: As described above Safari: As described above Firebox: Can filter with "has open projects" and one category, but not more than one category Safari mobile: Filtering works as intended

Which browser were you using?

fumba commented 6 years ago

@emilycoleman thanks for the response.

Browsers: Chrome Version 65.0.3325.181 (Official Build) (64-bit), EDGE Microsoft Edge 40.15063.674.0

This is how I am attempting to reproduce this issue:

  1. Accessed http://dev.code4socialgood.org/organization/list/organizations - 39 orgs initially load.
  2. Checked "Non Profit" - 36 orgs are found.
  3. Checked "Has Open Projects" - 21 orgs are found.

I was expecting for the filter not to work on step 3. Please let me know if I am missing a step.

emilycoleman commented 6 years ago

@fumba Try:

  1. Selecting "Open Source" (2 organizations found)
  2. Selecting "Nonprofit" (2 organizations found)
  3. Deselecting "Open Source" (36 organizations found)
fumba commented 6 years ago

Established that organisation search is returning Error 400 when more than one categories is used in the query. The following error is being returning from the web service call. This issue needs to be created and investigated from Code4SocialGood/c4sg-services.

Error from Global BadRequest. org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected AST node: {vector} [SELECT DISTINCT o FROM org.c4sg.entity.Project p RIGHT OUTER JOIN p.organization o WHERE ((:keyword is null OR LOWER(o.name) LIKE LOWER(CONCAT('%', :keyword, '%')) OR LOWER(o.description) LIKE LOWER(CONCAT('%', :keyword, '%')) OR LOWER(o.country) LIKE LOWER(CONCAT('%', :keyword, '%'))) AND (:status is null OR o.status = :status) AND (:categories0, :categories1 is null OR o.category in (:categories0, :categories1)) AND (:open is null )) ORDER BY o.name ASC]; nested exception is java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected AST node: {vector} [SELECT DISTINCT o FROM org.c4sg.entity.Project p RIGHT OUTER JOIN p.organization o WHERE ((:keyword is null OR LOWER(o.name) LIKE LOWER(CONCAT('%', :keyword, '%')) OR LOWER(o.description) LIKE LOWER(CONCAT('%', :keyword, '%')) OR LOWER(o.country) LIKE LOWER(CONCAT('%', :keyword, '%'))) AND (:status is null OR o.status = :status) AND (:categories0, :categories1 is null OR o.category in (:categories0, :categories1)) AND (:open is null )) ORDER BY o.name ASC]"

screenshot from 2018-04-09 20-29-29

fumba commented 6 years ago

Created c4sg-services/Issue 416. Closing it from here.

fumba commented 6 years ago

Re-opening this issue after realizing that all issues (both frontend and backend) are to be kept under this repo.

fumba commented 6 years ago

@emilycoleman the fix for this has been tested and pushed to dev. Please verify this and close this ticket if you determine that the bug is resolved. Thanks,