Bugzilla – Attachment 79580 Details for
Bug 20797
If an Ill request has an associated bib record, the detail view should contain a link to the record
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20996: Further enhance performance
Bug-20996-Further-enhance-performance.patch (text/plain), 4.01 KB, created by
Magnus Enger
on 2018-09-28 13:17:31 UTC
(
hide
)
Description:
Bug 20996: Further enhance performance
Filename:
MIME Type:
Creator:
Magnus Enger
Created:
2018-09-28 13:17:31 UTC
Size:
4.01 KB
patch
obsolete
>From ef26a2ab9ec2044215e921fc5e52ee264a9d3b93 Mon Sep 17 00:00:00 2001 >From: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> >Date: Thu, 5 Jul 2018 14:46:16 +0100 >Subject: [PATCH] Bug 20996: Further enhance performance > >We were immediately unblessing all request objects after retrieval then, >at a later stage, re-instantiating each one so we could call methods on >that. This was a very bad idea. We now preserve the objects for as long >as we can. > >Signed-off-by: Magnus Enger <magnus@enger.priv.no> > >https://bugs.koha-community.org/show_bug.cgi?id=20797 >--- > Koha/REST/V1/Illrequests.pm | 44 +++++++++++++++++++++++--------------------- > 1 file changed, 23 insertions(+), 21 deletions(-) > >diff --git a/Koha/REST/V1/Illrequests.pm b/Koha/REST/V1/Illrequests.pm >index 59e3f82a44..0a6dee0e2b 100644 >--- a/Koha/REST/V1/Illrequests.pm >+++ b/Koha/REST/V1/Illrequests.pm >@@ -51,18 +51,20 @@ sub list { > delete $args->{embed}; > } > >- my $requests = Koha::Illrequests->unblessed; >+ # Get all requests >+ my @requests = Koha::Illrequests->as_list; > > # Identify patrons & branches that > # we're going to need and get them >- my $to_fetch = {}; >- $to_fetch->{patrons} = {} if $embed{patron}; >- $to_fetch->{branches} = {} if $embed{library}; >- $to_fetch->{capabilities} = {} if $embed{capabilities}; >- foreach my $req(@{$requests}) { >- $to_fetch->{patrons}->{$req->{borrowernumber}} = 1 if $embed{patron}; >- $to_fetch->{branches}->{$req->{branchcode}} = 1 if $embed{library}; >- $to_fetch->{capabilities}->{$req->{backend}} = 1 if $embed{capabilities}; >+ my $to_fetch = { >+ patrons => {}, >+ branches => {}, >+ capabilities => {} >+ }; >+ foreach my $req(@requests) { >+ $to_fetch->{patrons}->{$req->borrowernumber} = 1 if $embed{patron}; >+ $to_fetch->{branches}->{$req->branchcode} = 1 if $embed{library}; >+ $to_fetch->{capabilities}->{$req->backend} = 1 if $embed{capabilities}; > } > > # Fetch the patrons we need >@@ -100,15 +102,14 @@ sub list { > } > } > >- > # Now we've got all associated users and branches, > # we can augment the request objects >- foreach my $req(@{$requests}) { >- my $r = Koha::Illrequests->new->find($req->{illrequest_id}); >- $req->{id_prefix} = $r->id_prefix; >+ my @output = (); >+ foreach my $req(@requests) { >+ my $to_push = $req->unblessed; > foreach my $p(@{$patron_arr}) { >- if ($p->{borrowernumber} == $req->{borrowernumber}) { >- $req->{patron} = { >+ if ($p->{borrowernumber} == $req->borrowernumber) { >+ $to_push->{patron} = { > firstname => $p->{firstname}, > surname => $p->{surname}, > cardnumber => $p->{cardnumber} >@@ -117,28 +118,29 @@ sub list { > } > } > foreach my $b(@{$branch_arr}) { >- if ($b->{branchcode} eq $req->{branchcode}) { >- $req->{library} = $b; >+ if ($b->{branchcode} eq $req->branchcode) { >+ $to_push->{library} = $b; > last; > } > } > if ($embed{metadata}) { > my $metadata = Koha::Illrequestattributes->search( >- { illrequest_id => $req->{illrequest_id} }, >+ { illrequest_id => $req->illrequest_id }, > { columns => [qw/type value/] } > )->unblessed; > my $meta_hash = {}; > foreach my $meta(@{$metadata}) { > $meta_hash->{$meta->{type}} = $meta->{value}; > } >- $req->{metadata} = $meta_hash; >+ $to_push->{metadata} = $meta_hash; > } > if ($embed{capabilities}) { >- $req->{capabilities} = $to_fetch->{$req->{backend}}; >+ $to_push->{capabilities} = $to_fetch->{$req->backend}; > } >+ push @output, $to_push; > } > >- return $c->render( status => 200, openapi => $requests ); >+ return $c->render( status => 200, openapi => \@output ); > } > > 1; >-- >2.11.0
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 20797
:
75454
|
75485
|
75486
|
75656
|
75870
|
79495
|
79496
|
79497
|
79578
|
79579
|
79580
|
79581
|
79582
|
79946
|
79947
|
80018
|
80019
|
80021
|
80022
|
80038
|
80040
|
80047
|
80048
|
80049
|
80055
|
80071
|
80072
|
80073
|
80120
|
80121
|
80122