Skip to content

Commit

Permalink
Fixes lane saving bug (#1688)
Browse files Browse the repository at this point in the history
Resolves: https://ebce-lyrasis.atlassian.net/browse/PP-986
(cherry picked from commit e9d2d8b0f009a216314d110b8088446c47c38252)
  • Loading branch information
dbernstein authored and ttuovinen committed Feb 29, 2024
1 parent 2de18b4 commit 4576936
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions api/admin/controller/custom_lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion api/admin/controller/lanes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 1 addition & 4 deletions core/lane.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 4576936

Please sign in to comment.