Bug 6025 - Script to recreate entries in the statistics table from the issues and oldissues table
Summary: Script to recreate entries in the statistics table from the issues and oldiss...
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: 3.8
Hardware: All All
: P3 enhancement (vote)
Assignee: Matthias Meusburger
QA Contact: Bugs List
Depends on:
Blocks: 5992
  Show dependency treegraph
Reported: 2011-03-31 20:27 UTC by Chris Cormack
Modified: 2013-12-05 20:04 UTC (History)
4 users (show)

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

Proposed Patch (3.18 KB, patch)
2011-03-31 20:31 UTC, Chris Cormack
Details | Diff | Splinter Review
Followup patch (6.09 KB, patch)
2011-03-31 20:42 UTC, Chris Cormack
Details | Diff | Splinter Review
Fix Free Software Foundation address (1.09 KB, patch)
2011-09-16 10:41 UTC, Matthias Meusburger
Details | Diff | Splinter Review
Proposed patch (6.88 KB, patch)
2012-02-03 10:54 UTC, Matthias Meusburger
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Cormack 2011-03-31 20:27:35 UTC

Comment 1 Chris Cormack 2011-03-31 20:31:55 UTC Comment hidden (obsolete)
Comment 2 Chris Cormack 2011-03-31 20:42:20 UTC Comment hidden (obsolete)
Comment 3 Chris Cormack 2011-06-15 00:59:49 UTC
The first patch has the wrong address for the Free Software Foundation, Can we get a followup that corrects that please?
Comment 4 Matthias Meusburger 2011-09-16 10:41:09 UTC Comment hidden (obsolete)
Comment 5 Paul Poulain 2011-10-24 11:38:15 UTC
Updating Version : This ENH will be for Koha 3.8
Comment 6 Paul Poulain 2011-10-25 15:05:50 UTC
Bug versionned for master. entries will be made against rel_3_8 once the patch has been applied (see thread about that on koha-devel yesterday)
Comment 7 Katrin Fischer 2011-12-21 05:43:56 UTC
Hi Matthias,
can you provide a test plan for this? In which circumstances one would use the script? The second patch seems to delete all documentation about the script?

All 3 patches still apply to master.
Comment 8 Matthias Meusburger 2012-02-03 10:54:34 UTC
Created attachment 7438 [details] [review]
Proposed patch
Comment 9 Matthias Meusburger 2012-02-03 11:03:38 UTC
Hi Katrin,

This script is to be used when the statistics table is incomplete. 

It happened to one of our customers: because of a database inconsistency, the statistics table was not populated during some time. 

This script was created to recreate those missing statistics from the issues and old_issues tables data.

I can't figure out why the documentation was removed from the script with the second patch, though.

Anyhow, I found a more recent version in our repository, which I attached. It adds counters for the number of issues, renewals, and returns added, as well as command-line options for processing only issues or only returns.
Comment 10 Katrin Fischer 2012-02-22 06:42:40 UTC
Hi Matthias, 
thx for your explanation! Sounds like this could be a tool for migrations too? 

I only have a very small testing database with almost no circulation activities - so it's a bit hard to test for me. Perhaps someone else with a bigger database might be willing to give this a try?
Comment 11 Pierre Angot 2012-03-19 15:29:54 UTC
Test ok on sandbox
Comment 12 Ian Walls 2012-03-19 21:40:23 UTC
Script is self-contained, so it won't affect other parts of the code (beyond updating the statistics table).

Works on both issues and renewals, though I find it a little odd that not specifying either specifies both... just a comment, not a problem.

Looks to be a very useful tool for recreating lost statistics (as best as one can).  Could be handy for migrations.

Marking as Passed QA.
Comment 13 Paul Poulain 2012-03-20 16:04:07 UTC
versionned for 3.8, to be sure I document it in my release notes, may be applied to 3.6 safely
Comment 14 Jared Camins-Esakov 2012-12-31 00:44:40 UTC
There have been no further reports of problems so I am marking this bug resolved.