Bug 21027

Summary: Totals in statistics tab change when StatisticsFields is changed
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: CirculationAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: christian.stelzenmueller, fridolin.somers, gmcharlt, jonathan.druart, kyle.m.hall, lucas
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.11.00,19.05.03,18.11.09
Bug Depends on:    
Bug Blocks: 9939    
Attachments: statistics tab
current checkouts
Bug 21027; Fix checkout statistics if 1+ of the fields is not defined
Screenshot_total_checkouts without patch
Bug 21027; Fix checkout statistics if 1+ of the fields is not defined
Bug 21027: Fix checkout statistics if 1+ of the fields is not defined

Description Katrin Fischer 2018-07-02 14:56:00 UTC
As we understand it the totals in the last line of the statistics table in the patron account should be always the same, independent of the selection made in the StatisticsFields system preference.

This is not the case.

When "location" is removed, the total is less than with "location".

I think this might have something to do with the group and empty values for some entries, but have not been able to find the problem yet.
Comment 1 Jonathan Druart 2018-07-11 22:09:40 UTC
Screenshots? Which values are different?
Comment 2 Katrin Fischer 2018-07-12 05:32:53 UTC
- Use a patron who hasn't checked out items before
- Set  StatisticsFields to itype|ccode
- Check out some items without location
- Verify that statistics stable shows the correct number of checkouts
- Check out one item with a location or just change one of your checked out items
- Verify the total is still correct
- Change  StatisticsFields to location|itype|ccode
- Verify the total has changed now - it's only 1 (the one with a location)
Comment 3 Katrin Fischer 2018-07-12 05:33:45 UTC
I retested it on master... not quite the same result as last time, but still something strange going on here. Hope the test plan works for you.
Comment 4 Katrin Fischer 2018-07-12 05:44:44 UTC
Created attachment 76874 [details]
statistics tab
Comment 5 Katrin Fischer 2018-07-12 05:45:25 UTC
Created attachment 76875 [details]
current checkouts
Comment 6 Katrin Fischer 2018-07-12 05:46:44 UTC
For the screenshot the pref was set to location|itype|ccode. If location is removed, the number of checkouts shows as 2 (which is correct).

Note: in the screenshot, the shelving location is also not shown?
Comment 7 Jonathan Druart 2019-04-29 00:57:51 UTC
Created attachment 88990 [details] [review]
Bug 21027; Fix checkout statistics if 1+ of the fields is not defined
Comment 8 Jonathan Druart 2019-04-29 00:58:59 UTC
Hi Katrin,

I think this patch fixes the problem you faced. I did not read a test plan as I have to admit I completely forgot about that code and not sure how the changes could be completely tested.
Comment 9 Christian Stelzenmüller 2019-04-29 09:42:39 UTC
Created attachment 89008 [details]
Screenshot_total_checkouts without patch
Comment 10 Chris Cormack 2019-07-11 06:22:11 UTC
Created attachment 91455 [details] [review]
Bug 21027; Fix checkout statistics if 1+ of the fields is not defined

TEST

- Use a patron who hasn't checked out items before
- Set  StatisticsFields to itype|ccode
- Check out some items without location
- Verify that statistics stable shows the correct number of checkouts
- Check out one item with a location or just change one of your checked out items
- Verify the total is still correct
- Change  StatisticsFields to location|itype|ccode
- Verify the total has changed now - it's only 1 (the one with a location)

Apply the patch and try again

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Comment 11 Katrin Fischer 2019-07-12 06:09:00 UTC
Created attachment 91472 [details] [review]
Bug 21027: Fix checkout statistics if 1+ of the fields is not defined

TEST

- Use a patron who hasn't checked out items before
- Set  StatisticsFields to itype|ccode
- Check out some items without location
- Verify that statistics stable shows the correct number of checkouts
- Check out one item with a location or just change one of your checked out items
- Verify the total is still correct
- Change  StatisticsFields to location|itype|ccode
- Verify the total has changed now - it's only 1 (the one with a location)

Apply the patch and try again

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 12 Martin Renvoize 2019-07-15 11:43:38 UTC
Nice work!

Pushed to master for 19.11.00
Comment 13 Fridolin Somers 2019-08-06 13:18:50 UTC
Pushed to 19.05.x for 19.05.03
Comment 14 Lucas Gass 2019-08-13 19:25:02 UTC
backported to 18.11.x for 18.11.09