[Bug 43931] New: Suggestions page can be slow to load when many suggestions from many patrons exist
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43931 Bug ID: 43931 Summary: Suggestions page can be slow to load when many suggestions from many patrons exist Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Acquisitions Assignee: koha-bugs@lists.koha-community.org Reporter: nick@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org Target Milestone: --- When loading the suggestions page on systems with many suggestions we have seen a slowdown, the issue seems to stem from this section: my @codes_list = map { { 'code' => $$_{'value'}, 'desc' => GetCriteriumDesc( $$_{'value'}, $field ) || $$_{'value'}, 'selected' => ( $$suggestion_ref{$field} ) ? $$_{'value'} eq $$suggestion_ref{$field} : 0, } } grep { $$_{'value'} } @$values_list; Specifically when dealing with suggestions.suggestedby GetCriteriumDesc ends up fetching the patron object for each patron in order to get their first and last name and map it for display as a fitler. Either we need to fetch all patrons at once, or we can simply remove this filter from the page as we can now search suggesters using datatables much faster -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43931 Emily Lamancusa (emlam) <emily.lamancusa@montgomerycountymd.gov> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |emily.lamancusa@montgomeryc | |ountymd.gov -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43931 --- Comment #1 from Nick Clemens (kidclamp) <nick@bywatersolutions.com> --- Created attachment 209352 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209352&action=edit Sample of ~100k patrons and suggestions zcat bug_43931.tar.gz | sudo koha-mysql kohadev -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43931 Nick Clemens (kidclamp) <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |nick@bywatersolutions.com |ity.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43931 --- Comment #2 from Nick Clemens (kidclamp) <nick@bywatersolutions.com> --- Created attachment 212740 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212740&action=edit Bug 43931: [WIP] Add /api/v1/suggestions/suggesters endpoint This patch adds a new endpoint that returns the list of patrons who have made at least one purchase suggestion. Each patron is returned once, regardless of how many suggestions they have made. The REST API cannot filter patrons on their related suggestions, and listing suggestions with the suggester embedded returns one row per suggestion, so a dedicated endpoint is needed, similar to /api/v1/suggestions/managers. Test plan: 1. Apply patch 2. Run: yarn api:bundle 3. Restart all 4. prove t/db_dependent/api/v1/suggestions.t 5. Create some suggestions for a few patrons 6. GET /api/v1/suggestions/suggesters 7. Confirm only the patrons with suggestions are returned, once each Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43931 --- Comment #3 from Nick Clemens (kidclamp) <nick@bywatersolutions.com> --- Created attachment 212741 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212741&action=edit Bug 43931: [WIP] Use select2 with API lookups for suggestion patron filters When loading the suggestions page, the 'Suggested by', 'Managed by' and 'Accepted by' filters were built by fetching every distinct patron referenced in the suggestions table, one at a time. On systems with many suggesters this makes the page very slow, or time out entirely. This patch replaces those dropdowns with select2 dropdowns that search patrons through the REST API: - Suggested by uses /api/v1/suggestions/suggesters - Managed by and Accepted by use /api/v1/suggestions/managers Only the currently selected patrons are fetched when the page loads. The unused budgetid_loop is also removed. Test plan: 1. Load the sample data from the bug: zcat bug_43931.tar.gz | sudo koha-mysql kohadev 2. Go to Acquisitions -> Suggestions 3. Note the page is very slow to load, or times out 4. Apply patches 5. Run: yarn api:bundle 6. Restart all 7. Reload the suggestions page, it should load quickly 8. Expand 'Suggestion information' in the filters on the left 9. Open 'Suggested by', confirm patrons with suggestions are listed and can be searched 10. Open 'Managed by' and 'Accepted by', confirm staff with the suggestions_manage permission are listed and can be searched 11. Select patrons in the filters and click 'Go' 12. Confirm the results are filtered and the selected patrons remain selected in the dropdowns 13. Clear a filter, click 'Go', confirm the filter is removed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org