-
Notifications
You must be signed in to change notification settings - Fork 11
Description
Summary
Several small issues were discovered related to the default filters recently introduced in #951 & #954.
Detailed Description
- Filters are not applied to charts in the session detail view (non-lepidoptera still showing in top 10)
- Need to add some include & exclude taxa to all existing projects, perhaps make it a default for new projects
- Cached counts related to Stations (# occurrences) are not updated when the default filters change
- Taxa detail pages return 404 if they don't pass the default filters. (http://localhost:4000/projects/24/taxa/4541?taxa_list_id=15&include_unobserved=true&ordering=-occurrences_count)
Implementation Details
Each issue has a different implementation.
-
Add the reusable filter method to the query used for chart data (check the project summary charts as well)
-
Add a migration, add environment variables similar to default pipelines for default include & excludes. Create a new
get_project_default_filtersfunction to read those variables and call it from theget_or_create_default_projectfunction to set the default filter fields in the ProjectSettingsMixin -
Multiple options. Remove cached values if the query can be fast enough to be dynamic, or bust the cache of these values when the filters are changed (perhaps a signal that checks if the default filter values were modified, then resave related models that have cached counts of occurrences or taxa)
-
Add the
apply_defaultsquery param to the taxa detail page (with the other filter query params) - ensure the get_queryset for the detail view action ignores apply_defaults (or defaults to False). Move this queryset filter under the list view conditional.
I recommend fixing 1 & 4 first. Then another PR(s) for 2 & 3