Bugzilla – Attachment 99280 Details for
Bug 24670
Circulation and fine rules page has performance issues since issuingrules change
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24670: Fetch all circulation rules at once to fix perf regression
Bug-24670-Fetch-all-circulation-rules-at-once-to-f.patch (text/plain), 8.43 KB, created by
Martin Renvoize (ashimema)
on 2020-02-19 21:17:01 UTC
(
hide
)
Description:
Bug 24670: Fetch all circulation rules at once to fix perf regression
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-02-19 21:17:01 UTC
Size:
8.43 KB
patch
obsolete
>From f7387b682c1d089043193952dddfa0d6d99c86fb Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 17 Feb 2020 12:54:56 +0100 >Subject: [PATCH] Bug 24670: Fetch all circulation rules at once to fix perf > regression > >Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > admin/smart-rules.pl | 9 ++- > .../prog/en/modules/admin/smart-rules.tt | 60 ++++++++++--------- > 2 files changed, 39 insertions(+), 30 deletions(-) > >diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl >index dc8033b7f5..45c566eba1 100755 >--- a/admin/smart-rules.pl >+++ b/admin/smart-rules.pl >@@ -562,7 +562,13 @@ my $itemtypes = Koha::ItemTypes->search_with_localization; > > my $humanbranch = ( $branch ne '*' ? $branch : undef ); > >-my $definedbranch = Koha::CirculationRules->search({ branchcode => $humanbranch })->count ? 1 : 0; >+my $all_rules = Koha::CirculationRules->search({ branchcode => $humanbranch }); >+my $definedbranch = $all_rules->count ? 1 : 0; >+ >+while ( my $r = $all_rules->next ) { >+ $r = $r->unblessed; >+ $rules->{ $r->{categorycode} }->{ $r->{itemtype} }->{ $r->{rule_name} } = $r->{rule_value}; >+} > > $template->param(show_branch_cat_rule_form => 1); > >@@ -572,6 +578,7 @@ $template->param( > humanbranch => $humanbranch, > current_branch => $branch, > definedbranch => $definedbranch, >+ all_rules => $rules, > ); > output_html_with_http_headers $input, $cookie, $template->output; > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >index e40138b31b..e0f50bf619 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >@@ -123,36 +123,38 @@ > <tbody> > [% SET row_count = 0 %] > [% FOREACH c IN categorycodes %] >+ [% SET c = '' UNLESS c.defined %] > [% FOREACH i IN itemtypes %] >- [% SET note = CirculationRules.Search( branchcode, c, i, 'note' ) %] >- [% SET maxissueqty = CirculationRules.Search( branchcode, c, i, 'maxissueqty' ) %] >- [% SET maxonsiteissueqty = CirculationRules.Search( branchcode, c, i, 'maxonsiteissueqty' ) %] >- [% SET issuelength = CirculationRules.Search( branchcode, c, i, 'issuelength' ) %] >- [% SET lengthunit = CirculationRules.Search( branchcode, c, i, 'lengthunit' ) %] >- [% SET hardduedate = CirculationRules.Search( branchcode, c, i, 'hardduedate' ) %] >- [% SET hardduedatecompare = CirculationRules.Search( branchcode, c, i, 'hardduedatecompare' ) %] >- [% SET fine = CirculationRules.Search( branchcode, c, i, 'fine' ) %] >- [% SET chargeperiod = CirculationRules.Search( branchcode, c, i, 'chargeperiod' ) %] >- [% SET chargeperiod_charge_at = CirculationRules.Search( branchcode, c, i, 'chargeperiod_charge_at' ) %] >- [% SET firstremind = CirculationRules.Search( branchcode, c, i, 'firstremind' ) %] >- [% SET overduefinescap = CirculationRules.Search( branchcode, c, i, 'overduefinescap' ) %] >- [% SET cap_fine_to_replacement_price = CirculationRules.Search( branchcode, c, i, 'cap_fine_to_replacement_price' ) %] >- [% SET finedays = CirculationRules.Search( branchcode, c, i, 'finedays' ) %] >- [% SET maxsuspensiondays = CirculationRules.Search( branchcode, c, i, 'maxsuspensiondays' ) %] >- [% SET suspension_chargeperiod = CirculationRules.Search( branchcode, c, i, 'suspension_chargeperiod' ) %] >- [% SET renewalsallowed = CirculationRules.Search( branchcode, c, i, 'renewalsallowed' ) %] >- [% SET renewalperiod = CirculationRules.Search( branchcode, c, i, 'renewalperiod' ) %] >- [% SET norenewalbefore = CirculationRules.Search( branchcode, c, i, 'norenewalbefore' ) %] >- [% SET auto_renew = CirculationRules.Search( branchcode, c, i, 'auto_renew' ) %] >- [% SET no_auto_renewal_after = CirculationRules.Search( branchcode, c, i, 'no_auto_renewal_after' ) %] >- [% SET no_auto_renewal_after_hard_limit = CirculationRules.Search( branchcode, c, i, 'no_auto_renewal_after_hard_limit' ) %] >- [% SET reservesallowed = CirculationRules.Search( branchcode, c, i, 'reservesallowed' ) %] >- [% SET holds_per_day = CirculationRules.Search( branchcode, c, i, 'holds_per_day' ) %] >- [% SET holds_per_record = CirculationRules.Search( branchcode, c, i, 'holds_per_record' ) %] >- [% SET onshelfholds = CirculationRules.Search( branchcode, c, i, 'onshelfholds' ) %] >- [% SET opacitemholds = CirculationRules.Search( branchcode, c, i, 'opacitemholds' ) %] >- [% SET article_requests = CirculationRules.Search( branchcode, c, i, 'article_requests' ) %] >- [% SET rentaldiscount = CirculationRules.Search( branchcode, c, i, 'rentaldiscount' ) %] >+ [% SET i = '' UNLESS i.defined %] >+ [% SET note = all_rules.$c.$i.note %] >+ [% SET maxissueqty = all_rules.$c.$i.maxissueqty %] >+ [% SET maxonsiteissueqty = all_rules.$c.$i.maxonsiteissueqty %] >+ [% SET issuelength = all_rules.$c.$i.issuelength %] >+ [% SET lengthunit = all_rules.$c.$i.lengthunit %] >+ [% SET hardduedate = all_rules.$c.$i.hardduedate %] >+ [% SET hardduedatecompare = all_rules.$c.$i.hardduedatecompare %] >+ [% SET fine = all_rules.$c.$i.fine %] >+ [% SET chargeperiod = all_rules.$c.$i.chargeperiod %] >+ [% SET chargeperiod_charge_at = all_rules.$c.$i.chargeperiod_charge_at %] >+ [% SET firstremind = all_rules.$c.$i.firstremind %] >+ [% SET overduefinescap = all_rules.$c.$i.overduefinescap %] >+ [% SET cap_fine_to_replacement_price = all_rules.$c.$i.cap_fine_to_replacement_price %] >+ [% SET finedays = all_rules.$c.$i.finedays %] >+ [% SET maxsuspensiondays = all_rules.$c.$i.maxsuspensiondays %] >+ [% SET suspension_chargeperiod = all_rules.$c.$i.suspension_chargeperiod %] >+ [% SET renewalsallowed = all_rules.$c.$i.renewalsallowed %] >+ [% SET renewalperiod = all_rules.$c.$i.renewalperiod %] >+ [% SET norenewalbefore = all_rules.$c.$i.norenewalbefore %] >+ [% SET auto_renew = all_rules.$c.$i.auto_renew %] >+ [% SET no_auto_renewal_after = all_rules.$c.$i.no_auto_renewal_after %] >+ [% SET no_auto_renewal_after_hard_limit = all_rules.$c.$i.no_auto_renewal_after_hard_limit %] >+ [% SET reservesallowed = all_rules.$c.$i.reservesallowed %] >+ [% SET holds_per_day = all_rules.$c.$i.holds_per_day %] >+ [% SET holds_per_record = all_rules.$c.$i.holds_per_record %] >+ [% SET onshelfholds = all_rules.$c.$i.onshelfholds %] >+ [% SET opacitemholds = all_rules.$c.$i.opacitemholds %] >+ [% SET article_requests = all_rules.$c.$i.article_requests %] >+ [% SET rentaldiscount = all_rules.$c.$i.rentaldiscount %] > > [% SET show_rule = maxissueqty || maxonsiteissueqty || issuelength || lengthunit || hardduedate || hardduedatebefore || hardduedateexact || fine || chargeperiod || chargeperiod_charge_at || firstremind || overduefinescap || cap_fine_to_replacement_price || finedays || maxsuspensiondays || suspension_chargeperiod || renewalsallowed || renewalsallowed || norenewalbefore || auto_renew || no_auto_renewal_after || no_auto_renewal_after_hard_limit || reservesallowed || holds_per_day || holds_per_record || onshelfholds || opacitemholds || article_requests || article_requests %] > [% IF show_rule %] >-- >2.20.1
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 24670
:
99082
|
99278
|
99280
|
99281
|
99282
|
99286
|
99300