Bug 36585 - Patrons with the most checkouts Report when outputting to CSV doesn't have the total
Summary: Patrons with the most checkouts Report when outputting to CSV doesn't have th...
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Reports (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Michael Hafen
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-11 22:33 UTC by Michael Hafen
Modified: 2024-08-27 19:37 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Improve bor_issues_top report (633 bytes, patch)
2024-04-11 22:41 UTC, Michael Hafen
Details | Diff | Splinter Review
improve bor_issues_top report (6.42 KB, patch)
2024-05-29 19:52 UTC, Michael Hafen
Details | Diff | Splinter Review
Bug 36585: Improve 'Patrons with the most checkouts' report (7.55 KB, patch)
2024-05-30 01:21 UTC, David Nind
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Hafen 2024-04-11 22:33:12 UTC
I will submit a patch which:
Adds the total to csv output.
Changes screen output to only show the patrons name once, instead of with each group by column.
Also show total checkout when output to screen.
Changes item type group by from biblioitems.itemtype to items.itype.
Comment 1 Michael Hafen 2024-04-11 22:41:50 UTC
Created attachment 164782 [details] [review]
Improve bor_issues_top report
Comment 2 Michael Hafen 2024-04-11 22:43:07 UTC
[ The test plan is in the patch, but I forgot to copy it here. ]

Try the following with and without a group by, specifically item type.

1. Generate the report with output to screen with a group by.
2. Observe that the patron name is repeated for each column group.
3. Observe that there is no total column.
4. Generate the report with output to csv.
5. Observe that the total check outs is not in the csv.
6. Apply patch. restart Koha.
7. Generate the report to csv again.
8. Observe that the total checkouts is in the csv.
9. Generate the report to screen again.
10. Observe that there is a total column and the patron name is only in one
column.
Comment 3 David Nind 2024-05-25 19:04:34 UTC
Hi Michael.

There doesn't seem to be a patch attached, as far as I can see.

I've changed the assignee to yourself.

David
Comment 4 Michael Hafen 2024-05-29 19:52:34 UTC
Created attachment 167248 [details] [review]
improve bor_issues_top report

Try the following with and without a group by, specifically item type.

1. Generate the report with output to screen with a group by.
2. Observe that the patron name is repeated for each column group.
3. Observe that there is no total column.
4. Generate the report with output to csv.
5. Observe that the total check outs is not in the csv.
6. Apply patch. restart Koha.
7. Generate the report to csv again.
8. Observe that the total checkouts is in the csv.
9. Generate the report to screen again.
10. Observe that there is a total column and the patron name is only in one
column.
Comment 5 David Nind 2024-05-30 01:17:53 UTC
Changing status back to needs sign off.

The commit message needs formatting according to the https://wiki.koha-community.org/wiki/Commit_messages

I will update the commit message when I sign it off.
Comment 6 David Nind 2024-05-30 01:21:46 UTC
Created attachment 167251 [details] [review]
Bug 36585: Improve 'Patrons with the most checkouts' report

Update the 'Patrons with the most checkouts' report (bor_issues_top.pl)
to:
1. Add the total to the CSV output.
2. Change the screen output to only show the patrons name once, instead
   of for each group by column.
3. Add total check out when output to screen.
4. Change item type group by from biblioitems.itemtype to items.itype.

Note: This does not fix the SQL query so that it can run if the
database is in strict mode.

Test plan:
1. If using koha-testing-docker (KTD), set strict SQL mode for your
   database to 0 (that is, turn it off).
   (Edit <strict_sql_modes>0</strict_sql_modes> in
   /etc/koha/sites/kohadev/koha-conf.xml
   (and then flush_memcached and restart_all))
2. Add some data so that a useful report can be generated:
   . Check out and return some items to different patrons in different
     libraries:
     ==> Minimum end result:
         . two items issued to a patron for one library, 1 item issued
           and returned for the same patron at another library
         . one item issued to another patron from another patron
           category for one of the libraries used previously
3. Generate the report with output to screen with a group by, for
   example: 'By' option set to Category code
4. Observe that the patron name is repeated for each column group.
5. Observe that there is no total column.
6. Generate the report with output to CSV.
7. Observe that the total checkouts is not in the CSV.
8. Apply the patch and restart Koha (restart_all).
9. Generate the CSV report again.
10. Observe that the total checkouts is in the CSV.
11. Generate the report to screen again.
12. Observe that there is a total column and the patron name is only
    shown in one column.

Signed-off-by: David Nind <david@davidnind.com>
Comment 7 Lucas Gass 2024-08-27 19:05:39 UTC
Why the following line?

[% IF ( loopro.hilighted ) %]<td>[% ELSE %]<td>[% END %]
Comment 8 Michael Hafen 2024-08-27 19:37:31 UTC
(In reply to Lucas Gass from comment #7)
> Why the following line?
> 
> [% IF ( loopro.hilighted ) %]<td>[% ELSE %]<td>[% END %]

I don't know either, that line was there when I started.  I'm guessing it's for table row zebra stripping.

Yeah, digging through the history, that line used to toggle a 'hilighted' class, until 17 years ago in commit 1a90d0db7d.