From 227c25da2fc74a80bd30a02a8aaba0f18eb916d2 Mon Sep 17 00:00:00 2001 From: Dimas Date: Mon, 12 Aug 2024 12:35:27 +0100 Subject: [PATCH] Fix multi-sites overview --- bims/api_views/location_site_overview.py | 5 ++++- bims/tasks/location_site.py | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/bims/api_views/location_site_overview.py b/bims/api_views/location_site_overview.py index fd7c2f3fc..747402be9 100644 --- a/bims/api_views/location_site_overview.py +++ b/bims/api_views/location_site_overview.py @@ -48,6 +48,8 @@ class LocationSiteOverviewData(object): search_filters = None is_sass_exist = False + search_process = None + def biodiversity_data(self): if not self.search_filters: return {} @@ -175,7 +177,8 @@ def get(self, request): search_process, created = get_or_create_search_process( search_type=SITES_SUMMARY, - query=search_uri + query=search_uri, + requester=self.request.user ) results = search_process.get_file_if_exits() if results: diff --git a/bims/tasks/location_site.py b/bims/tasks/location_site.py index ee97a32c2..87f15e48f 100644 --- a/bims/tasks/location_site.py +++ b/bims/tasks/location_site.py @@ -46,7 +46,11 @@ def location_sites_overview( search_process.set_status(SEARCH_PROCESSING) overview_data = LocationSiteOverviewData() + if search_process.requester and 'requester' not in search_parameters: + search_parameters['requester'] = search_process.requester.id + overview_data.search_filters = search_parameters + results = dict() results[LocationSiteOverviewData.BIODIVERSITY_DATA] = ( overview_data.biodiversity_data()