Bug 10188

Summary: Top Most-circulated items doesn't count current loans
Product: Koha Reporter: Tomás Cohen Arazi <tomascohen>
Component: ReportsAssignee: Tomás Cohen Arazi <tomascohen>
Status: Failed QA --- QA Contact:
Severity: normal    
Priority: P5 - low CC: bibliwho, fridolin.somers, jonathan.druart, martin.renvoize, mayanksri1989, micah.bucy, veron
Version: master   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13914
Change sponsored?: Sponsored Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 17801    
Bug Blocks:    
Attachments: add union

Description Tomás Cohen Arazi 2013-05-03 17:24:56 UTC
Right now, the 'calculate' function only counts circulation from the old_issues table, and not issues.
Comment 1 Mayank 2013-08-19 07:32:45 UTC
If you generate a report of Most Circulated Items, you get a list of titles and their respective number of checkouts.
When you click on one of the titles you see all the details about that record, 
from that screen you can view the checkout history of that record.
The figures of Number of checkouts from the generated report(Most Circulated Items) and the checkout history for that record are different.
Comment 2 Micah Bucy 2014-07-22 20:59:57 UTC
Created attachment 29959 [details] [review]
add union

This patch depends on my patch http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=29958 for bug http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12628

This adds a union for `old_issues` and `issues`. Filtering that applied to `old_issues` before joins has been applied prior to the union on both `issues` and `old_issues`. Two new variables have been added to accomplish this $strsth2_filter and $strcalc_filter. The union is named as `circulated`. Where appropriate `old_issues` has been replaced with `circulated`.
Comment 3 Katrin Fischer 2023-01-25 22:53:49 UTC
The patch needs a little work, but I think this would still be nice to have. 

We could maybe add a note to the page to highlight the change?
Or a checkbox/option on the form, pre-checked, to include current loans.
Comment 4 Micah Bucy 2023-01-25 23:24:28 UTC
Alas, the library I was working on this for closed up not long after. I no longer have a system to make modifications to, so someone else will have to fix things up. 

Looks like the changes I proposed in the other patch I referenced were ultimately made in a more comprehensive fix to that particular problem, so whoever does at least shouldn't need to worry about that.

This was the only Perl experience I ever had, so that was fun. Hope someone else has fun building off this or coming up with a different solution.
Comment 5 Martin Renvoize 2023-01-26 10:00:38 UTC
Aw, that's such a shame we didn't manage to work this one through for you Micah.

I'll take a look at rebasing it for you and keeping the authorship, so you can get your name in the contributors list. :).