Summary
Several small issues were discovered related to the default filters recently introduced in #951 & #954.
Detailed Description
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_filters function to read those variables and call it from the get_or_create_default_project function 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_defaults query 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
Summary
Several small issues were discovered related to the default filters recently introduced in #951 & #954.
Detailed Description
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 ProjectSettingsMixinMultiple 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