Bugzilla – Attachment 153953 Details for
Bug 34223
ILL status filter does not load immediately after selecting a backend filter
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34223: Fix filter performance
Bug-34223-Fix-filter-performance.patch (text/plain), 3.17 KB, created by
Pedro Amorim
on 2023-07-27 09:40:22 UTC
(
hide
)
Description:
Bug 34223: Fix filter performance
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2023-07-27 09:40:22 UTC
Size:
3.17 KB
patch
obsolete
>From 0ac31458b390458d3f2fad9dfdfe1a518064b604 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Thu, 27 Jul 2023 09:40:03 +0000 >Subject: [PATCH] Bug 34223: Fix filter performance > >We are now only fetching the existing statuses for the provided backend. >Then, we fetch 1 illrequest object to make use of ->strings_map. >Before, we were fetching all illrequests in the database and removing redundant afterwards >--- > Koha/Illbackend.pm | 41 +++++++++++++++++++++-------------------- > 1 file changed, 21 insertions(+), 20 deletions(-) > >diff --git a/Koha/Illbackend.pm b/Koha/Illbackend.pm >index 8a6be8a7a6..7164edf42f 100644 >--- a/Koha/Illbackend.pm >+++ b/Koha/Illbackend.pm >@@ -48,36 +48,37 @@ Return a list of existing ILL statuses > sub existing_statuses { > my ( $self, $backend_id ) = @_; > >- #FIXME: Currently fetching all requests, it'd be great if we could fetch distinct(status). >- # Even doing it with distinct status, we need the ILL request object, so that strings_map works and >- # the ILL request returns the correct status and info respective to its backend. >- my $ill_requests = Koha::Illrequests->search( >+ # Fetch all existing statuses for the provided backend >+ my $backend_existing_statuses = Koha::Illrequests->search( > {backend => $backend_id}, >- # { >- # columns => [ qw/status/ ], >- # group_by => [ qw/status/ ], >- # } >+ { >+ columns => [ qw/status/ ], >+ group_by => [ qw/status/ ], >+ } > ); > > my @data; >- while (my $request = $ill_requests->next) { >- my $status_data = $request->strings_map; >+ while (my $backend_existing_status = $backend_existing_statuses->next) { >+ >+ my $illrequest = >+ Koha::Illrequests->search( >+ { backend => $backend_id, status => $backend_existing_status->status } >+ )->last; > >- foreach my $status_class ( qw(status_alias status) ){ >- if ($status_data->{$status_class}){ >+ my $status_data = $illrequest->strings_map; >+ >+ foreach my $status_class (qw(status_alias status)) { >+ if ( $status_data->{$status_class} ) { > push @data, { >- $status_data->{$status_class}->{str} ? (str => $status_data->{$status_class}->{str}) : >- $status_data->{$status_class}->{code} ? (str => $status_data->{$status_class}->{code}) : (), >- $status_data->{$status_class}->{code} ? (code => $status_data->{$status_class}->{code}) : (), >- } >+ $status_data->{$status_class}->{str} ? ( str => $status_data->{$status_class}->{str} ) >+ : $status_data->{$status_class}->{code} ? ( str => $status_data->{$status_class}->{code} ) >+ : (), >+ $status_data->{$status_class}->{code} ? ( code => $status_data->{$status_class}->{code} ) : (), >+ }; > } > } > } > >- # Remove duplicate statuses >- my %seen; >- @data = grep { my $e = $_; my $key = join '___', map { $e->{$_}; } sort keys %$_;!$seen{$key}++ } @data; >- > return \@data; > } > >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34223
:
153289
|
153953
|
153956
|
153957
|
153961
|
153962
|
153963
|
153968
|
153973
|
153978
|
153979
|
153980
|
153981
|
153989
|
153990
|
154026
|
154027
|
154028
|
154029
|
154030
|
154031
|
154032
|
154033
|
154068
|
154069
|
154070
|
154071
|
155280
|
155493