jariarkko / psgeo

Activity location library
BSD 3-Clause "New" or "Revised" License
3 stars 1 forks source link

Filter menu: clear/invert selection does not work correctly with multiple activities #352

Closed ralfstrandell closed 1 year ago

ralfstrandell commented 1 year ago

If several top level activities are selected in the filter pane that have subactivity filtering available, then clearing any one group of subactivities will hide all points on map.

The bug is somewhere deep inside psgeoRerunFilters(). Need to print the filter object to debug again using psgeoDebug(debugPrintObject(obj))

ralfstrandell commented 1 year ago

Need to investigate filterMatchMultiSubActivities function in psgeodb.js ... tracing back ... lib.filterMatchMultiSubActivities returns filterFalse if subactivities=[] => psgeoCreateSubactivityFilterFromCheckboxes returns filterFalse if all unchecked => psgeoCreateSubtypeGroupFilter returns as above, or undefined if all are checked => psgeoCreateSubtypeGroupFilters returns an array with defined filters included

Suspecting filterFalse to be the culprit. Investigating further later.

ralfstrandell commented 1 year ago

Found the problem.

Psgeo has been (historically) designed to show a map of one activity on one site. psgeoRerunFilters thus builds a filter using AND of the form: basic activity filter AND subactivities filter AND more filters ...

If any one of the activities selected has no subactivities selected, a filterFalse is returned as subactivity filter, and the composed filter is false and nothing is shown.

Now, the basic filter should be of the form: (activity1 AND subactivities1) OR (activity2 AND subactivities2) ...

Changes needed both in psgeoRerunFilters and in psgeoCreateSubtypeGroupFilter. The latter needs the activity as a parameter.

ralfstrandell commented 1 year ago

Resolved issue #352 by creating function psgeoCreateActivityAndSubactivityFilters and editing psgeoRerunFilters.