Bugzilla – Attachment 64308 Details for
Bug 13452
Average checkout report always uses biblioitems.itemtype
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13452: Fix obvious issues in issues_avg_stats.pl
Bug-13452-Fix-obvious-issues-in-issuesavgstatspl.patch (text/plain), 4.56 KB, created by
Kyle M Hall (khall)
on 2017-06-15 10:53:24 UTC
(
hide
)
Description:
Bug 13452: Fix obvious issues in issues_avg_stats.pl
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2017-06-15 10:53:24 UTC
Size:
4.56 KB
patch
obsolete
>From 1aa6b0f56c117f758885bb99cc036930dd5892c9 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Fri, 2 Oct 2015 11:31:10 +0200 >Subject: [PATCH] Bug 13452: Fix obvious issues in issues_avg_stats.pl > >- Remove joins with issuingrules which are not needed >- Fix the SQL query so that $weight is now the value of COUNT(*) instead > of a timestamp >- QA fix: '$column eq $itype' instead of '$column =~ $itype' (same for > $line) > >Signed-off-by: Srdjan <srdjan@catalyst.net.nz> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > reports/issues_avg_stats.pl | 22 ++++------------------ > 1 file changed, 4 insertions(+), 18 deletions(-) > >diff --git a/reports/issues_avg_stats.pl b/reports/issues_avg_stats.pl >index c013f05..1e8e138 100755 >--- a/reports/issues_avg_stats.pl >+++ b/reports/issues_avg_stats.pl >@@ -235,7 +235,7 @@ sub calculate { > $linefilter[2] = @$filters[6] if ($line =~ /returndate/ ) ; > $linefilter[3] = @$filters[7] if ($line =~ /returndate/ ) ; > $linefilter[0] = @$filters[8] if ($line =~ /category/ ) ; >- $linefilter[0] = @$filters[9] if ($line =~ /itemtype/ ) ; >+ $linefilter[0] = @$filters[9] if ($line eq $itype); > $linefilter[0] = @$filters[10] if ($line =~ /branch/ ) ; > $linefilter[0] = @$filters[11] if ($line =~ /sort1/ ) ; > $linefilter[0] = @$filters[12] if ($line =~ /sort2/ ) ; >@@ -252,7 +252,7 @@ sub calculate { > $colfilter[2] = @$filters[6] if ($column =~ /returndate/ ) ; > $colfilter[3] = @$filters[7] if ($column =~ /returndate/ ) ; > $colfilter[0] = @$filters[8] if ($column =~ /category/ ) ; >- $colfilter[0] = @$filters[9] if ($column =~ $itype ) ; >+ $colfilter[0] = @$filters[9] if ($column eq $itype); > $colfilter[0] = @$filters[10] if ($column =~ /branch/ ) ; > $colfilter[0] = @$filters[11] if ($column =~ /sort1/ ) ; > $colfilter[0] = @$filters[12] if ($column =~ /sort2/ ) ; >@@ -286,10 +286,6 @@ sub calculate { > LEFT JOIN borrowers ON borrowers.borrowernumber=old_issues.borrowernumber > LEFT JOIN items ON old_issues.itemnumber=items.itemnumber > LEFT JOIN biblioitems ON (biblioitems.biblioitemnumber=items.biblioitemnumber) >- LEFT JOIN issuingrules ON >- (issuingrules.branchcode=old_issues.branchcode >- AND issuingrules.itemtype=$itype >- AND issuingrules.categorycode=borrowers.categorycode) > WHERE 1"; > > if (($line=~/timestamp/) or ($line=~/returndate/)){ >@@ -356,10 +352,6 @@ sub calculate { > LEFT JOIN borrowers ON borrowers.borrowernumber=old_issues.borrowernumber > LEFT JOIN items ON items.itemnumber=old_issues.itemnumber > LEFT JOIN biblioitems ON (biblioitems.biblioitemnumber=items.biblioitemnumber) >- LEFT JOIN issuingrules ON >- (issuingrules.branchcode=old_issues.branchcode >- AND issuingrules.itemtype=$itype >- AND issuingrules.categorycode=borrowers.categorycode) > WHERE 1"; > > if (($column=~/timestamp/) or ($column=~/returndate/)){ >@@ -385,13 +377,7 @@ sub calculate { > > my $sth2 = $dbh->prepare( $strsth2 ); > >- if (( @colfilter ) and ($colfilter[1])){ >- $sth2->execute("'".$colfilter[0]."'","'".$colfilter[1]."'"); >- } elsif ($colfilter[0]) { >- $sth2->execute; >- } else { >- $sth2->execute; >- } >+ $sth2->execute; > > while (my ($celvalue) = $sth2->fetchrow) { > my %cell; >@@ -426,7 +412,7 @@ sub calculate { > > # Processing average loanperiods > $strcalc .= "SELECT $linefield, $colfield, "; >- $strcalc .= " issuedate, returndate, old_issues.timestamp, COUNT(*), date_due, old_issues.renewals, issuelength FROM `old_issues`,borrowers,biblioitems LEFT JOIN items ON (biblioitems.biblioitemnumber=items.biblioitemnumber) LEFT JOIN issuingrules ON (issuingrules.branchcode=branchcode AND issuingrules.itemtype=$itype AND issuingrules.categorycode=categorycode) WHERE old_issues.itemnumber=items.itemnumber AND old_issues.borrowernumber=borrowers.borrowernumber"; >+ $strcalc .= " issuedate, returndate, COUNT(*) FROM `old_issues`,borrowers,biblioitems LEFT JOIN items ON (biblioitems.biblioitemnumber=items.biblioitemnumber) WHERE old_issues.itemnumber=items.itemnumber AND old_issues.borrowernumber=borrowers.borrowernumber"; > > @$filters[0]=~ s/\*/%/g if (@$filters[0]); > $strcalc .= " AND old_issues.timestamp > '" . @$filters[0] ."'" if ( @$filters[0] ); >-- >2.1.4
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 13452
:
40003
|
40004
|
40798
|
43053
|
48987
|
56246
|
63322
|
63323
|
63324
|
64304
|
64305
|
64306
|
64307
| 64308 |
64309