Bugzilla – Attachment 153956 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), 4.17 KB, created by
Pedro Amorim
on 2023-07-27 10:07:04 UTC
(
hide
)
Description:
Bug 34223: Fix filter performance
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2023-07-27 10:07:04 UTC
Size:
4.17 KB
patch
obsolete
>From 89559c0af7ea86a2d0c1598c16b6c9a00631ac90 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 | 78 +++++++++++++++++++++++++++++++--------------- > 1 file changed, 53 insertions(+), 25 deletions(-) > >diff --git a/Koha/Illbackend.pm b/Koha/Illbackend.pm >index 8a6be8a7a6..b51d665b97 100644 >--- a/Koha/Illbackend.pm >+++ b/Koha/Illbackend.pm >@@ -48,35 +48,63 @@ 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( >- {backend => $backend_id}, >- # { >- # columns => [ qw/status/ ], >- # group_by => [ qw/status/ ], >- # } >- ); >- > my @data; >- while (my $request = $ill_requests->next) { >- my $status_data = $request->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}) : (), >- } >- } >+ >+ # 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/], >+ } >+ ); >+ >+ while (my $backend_existing_status = $backend_existing_statuses->next) { >+ >+ my $illrequest = >+ Koha::Illrequests->search( >+ { backend => $backend_id, status => $backend_existing_status->status } >+ )->last; >+ >+ my $status_data = $illrequest->strings_map; >+ >+ if ( $status_data->{status} ) { >+ push @data, { >+ $status_data->{status}->{str} ? ( str => $status_data->{status}->{str} ) >+ : $status_data->{status}->{code} ? ( str => $status_data->{status}->{code} ) >+ : (), >+ $status_data->{status}->{code} ? ( code => $status_data->{status}->{code} ) : (), >+ }; > } > } > >- # Remove duplicate statuses >- my %seen; >- @data = grep { my $e = $_; my $key = join '___', map { $e->{$_}; } sort keys %$_;!$seen{$key}++ } @data; >+ # Fetch all existing status_alias for the provided backend >+ my $backend_existing_status_aliases = Koha::Illrequests->search( >+ { backend => $backend_id }, >+ { >+ columns => [qw/status_alias/], >+ group_by => [qw/status_alias/], >+ } >+ ); >+ >+ while ( my $backend_existing_status_alias = $backend_existing_status_aliases->next ) { >+ >+ my $illrequest = >+ Koha::Illrequests->search( >+ { backend => $backend_id, status_alias => $backend_existing_status_alias->status_alias } ) >+ ->last; >+ >+ my $status_data = $illrequest->strings_map; >+ >+ if ( $status_data->{status_alias} ) { >+ push @data, { >+ $status_data->{status_alias}->{str} ? ( str => $status_data->{status_alias}->{str} ) >+ : $status_data->{status_alias}->{code} ? ( str => $status_data->{status_alias}->{code} ) >+ : (), >+ $status_data->{status_alias}->{code} ? ( code => $status_data->{status_alias}->{code} ) : (), >+ }; >+ } >+ } > > 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