From 457693673df344603c42eb02b44f4ca090c75bda Mon Sep 17 00:00:00 2001 From: dbernstein Date: Wed, 21 Feb 2024 09:55:48 -0800 Subject: [PATCH] Fixes lane saving bug (#1688) Resolves: https://ebce-lyrasis.atlassian.net/browse/PP-986 (cherry picked from commit e9d2d8b0f009a216314d110b8088446c47c38252) --- api/admin/controller/custom_lists.py | 4 ++-- api/admin/controller/lanes.py | 2 +- core/lane.py | 5 +---- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/api/admin/controller/custom_lists.py b/api/admin/controller/custom_lists.py index c2fc8d4f7..9a0bc3ed3 100644 --- a/api/admin/controller/custom_lists.py +++ b/api/admin/controller/custom_lists.py @@ -290,7 +290,7 @@ def _create_or_update_list( # If this list was used to populate any lanes, those lanes need to have their counts updated. for lane in Lane.affected_by_customlist(list): - lane.update_size(self._db, self.search_engine) + lane.update_size(self._db, search_engine=self.search_engine) new_collections = [] for collection_id in collections: @@ -399,7 +399,7 @@ def custom_list(self, list_id: int) -> Response | dict | ProblemDetail | None: # Update the size for any lanes affected by this # CustomList which _weren't_ deleted. for lane in surviving_lanes: - lane.update_size(self._db, self.search_engine) + lane.update_size(self._db, search_engine=self.search_engine) return Response(str(_("Deleted")), 200) return None diff --git a/api/admin/controller/lanes.py b/api/admin/controller/lanes.py index ac80b125b..7e5e6bcb0 100644 --- a/api/admin/controller/lanes.py +++ b/api/admin/controller/lanes.py @@ -160,7 +160,7 @@ def lanes_for_parent(parent): for list in lane.customlists: if list.id not in custom_list_ids: lane.customlists.remove(list) - lane.update_size(self._db, self.search_engine) + lane.update_size(self._db, search_engine=self.search_engine) if is_new: return Response(str(lane.id), 201) diff --git a/core/lane.py b/core/lane.py index 0e7a42cd3..6af0a00d4 100644 --- a/core/lane.py +++ b/core/lane.py @@ -2953,10 +2953,7 @@ def uses_customlists(self): return True return False - @inject - def update_size( - self, _db, search_engine: ExternalSearchIndex = Provide["search.index"] - ): + def update_size(self, _db, search_engine: ExternalSearchIndex): """Update the stored estimate of the number of Works in this Lane.""" library = self.get_library(_db)