[Bug 11230] New: Refactor C4::Stats::UpdateStats and add UT
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11230 Bug ID: 11230 Summary: Refactor C4::Stats::UpdateStats and add UT Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Circulation Assignee: koha-bugs@lists.koha-community.org Reporter: mathieu.saby@univ-rennes2.fr QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle.m.hall@gmail.com I am not sure of the right Component for this bug. I want to improve Statistics recording (adding some new fields, adding custom fields, etc). The first preliminary step is in this patch, which improves current code. An other patch will provide new features. This patch - refactors C4::Stats::UpdateStats (it now takes a hashref as unique parameter, instead of a list of parameters) - add UT for it - change the calls made to this sub in C4::Accounts and C4::Circulation Also : - adds POD to C4::Stats::TotalPaid - adds some comments to C4::Stats::TotalPaid (I think I found some errors in it) M. Saby -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11230 mathieu saby <mathieu.saby@univ-rennes2.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |mathieu.saby@univ-rennes2.f |ity.org |r -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11230 mathieu saby <mathieu.saby@univ-rennes2.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11230 --- Comment #1 from mathieu saby <mathieu.saby@univ-rennes2.fr> --- Created attachment 22850 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=22850&action=edit [PATCH] Bug 11230 - Refactor C4::Stats::UpdateStats and add UT This patch - refactors C4::Stats::UpdateStats (it now takes a hashref as unique parameter, instead of a list of parameters) - add UT for it - change the calls made to this sub in C4::Accounts and C4::Circulation Additionnaly it also - adds POD to C4::Stats::TotalPaid - adds some comments to C4::Stats::TotalPaid (I think I found some errors in it) To test : 1. run "prove t/db_dependant/Stats.t -v" 2. make some circulation operations (checkout, checkin, renew, localuse) check the operations are rightly recorded in Statistics table (with a SQL query like "SELECT * FROM statistics WHERE datetime LIKE "2013-11-15%", if you run your test on the 15th november) 3. make some fine payments operations (writeoff, payment) check the operations are rightly recorded in Statistics table (with a SQL query like "SELECT * FROM statistics WHERE datetime LIKE "2013-11-15%", if you run your test on the 15th november) Note that there is probably an issue to fix in Accounts.pm : the user is saved instead of the branch. But this is not the purpose of this patch, so I kept the previous behavior for the moment. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11230 mathieu saby <mathieu.saby@univ-rennes2.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11230 mathieu saby <mathsabypro@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #22850|0 |1 is obsolete| | --- Comment #2 from mathieu saby <mathsabypro@gmail.com> --- Created attachment 26798 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=26798&action=edit [PATCH] Bug 11230 - Refactor C4::Stats::UpdateStats and add UT fix trailing whitespaces -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11230 mathieu saby <mathsabypro@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |7021 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11230 --- Comment #3 from mathieu saby <mathsabypro@gmail.com> --- I think this bug should be tested before improving stats (bug 7021) Mathieu -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11230 --- Comment #4 from mathieu saby <mathsabypro@gmail.com> --- Patch still applies in master. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11230 Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #26798|0 |1 is obsolete| | --- Comment #5 from Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> --- Created attachment 29158 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=29158&action=edit [SIGNED-OFF] Bug 11230 - Refactor C4::Stats::UpdateStats and add UT This patch - refactors C4::Stats::UpdateStats (it now takes a hashref as unique parameter, instead of a list of parameters) - add UT for it - change the calls made to this sub in C4::Accounts and C4::Circulation Additionnaly it also - adds POD to C4::Stats::TotalPaid - adds some comments to C4::Stats::TotalPaid (I think I found some errors in it) To test : 1. run "prove t/db_dependant/Stats.t -v" 2. make some circulation operations (checkout, checkin, renew, localuse) check the operations are rightly recorded in Statistics table (with a SQL query like "SELECT * FROM statistics WHERE datetime LIKE "2013-11-15%", if you run your test on the 15th november) 3. make some fine payments operations (writeoff, payment) check the operations are rightly recorded in Statistics table (with a SQL query like "SELECT * FROM statistics WHERE datetime LIKE "2013-11-15%", if you run your test on the 15th november) Note that there is probably an issue to fix in Accounts.pm : the user is saved instead of the branch. But this is not the purpose of this patch, so I kept the previous behavior for the moment. Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Work, test pass, isse/return/writeoff recorded on statistics Removed a "=back" to make happy koha-qa No other errors -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11230 Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off CC| |bgkriegel@gmail.com -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11230 --- Comment #6 from mathieu saby <mathsabypro@gmail.com> --- Thanks for signing What do you think of the point "Note that there is probably an issue to fix in Accounts.pm : the user is saved instead of the branch. But this is not the purpose of this patch, so I kept the previous behavior for the moment." Do you agree ? If so, I suppose it deserves a new bug. It could be easy to fix, but I did not try to write a patch, because I did not know if it would be necessary and possible to fix the wrong data already stored in statistics table. (and additionnaly I've got no time for that...) Mathieu -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11230 --- Comment #7 from Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> --- (In reply to mathieu saby from comment #6)
Thanks for signing
What do you think of the point "Note that there is probably an issue to fix in Accounts.pm : the user is saved instead of the branch. But this is not the purpose of this patch, so I kept the previous behavior for the moment."
Do you agree ? If so, I suppose it deserves a new bug It could be easy to fix, but I did not try to write a patch, because I did not know if it would be necessary and possible to fix the wrong data already stored in statistics table. (and additionnaly I've got no time for that...)
Hi Mathieu, You are right, and the removed comment said so. But looking into the code, seems that the logic was to record somehow what staff user did the payment. But there is a 'usercode' column in statistics table, that seems to be the right place for that info. A new bug is the right thing to do, maybe a mail to koha-devel first. Old data... is unfixable. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11230 --- Comment #8 from mathieu saby <mathsabypro@gmail.com> --- In fact I already made a bug for this issue in 2013 : Bug 11229 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11230 mathieu saby <mathsabypro@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |http://bugs.koha-community. | |org/bugzilla3/show_bug.cgi? | |id=11229 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11230 mathieu saby <mathsabypro@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11230 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA CC| |kyle@bywatersolutions.com --- Comment #9 from Kyle M Hall <kyle@bywatersolutions.com> --- I do believe all instances of "keys $params" need to be changed to "keys %$params". koha-qa -v 2 -c 1 testing 1 commit(s) (applied to cb8b0fe 'Bug 12508: Follow up - corrects capit') FAIL C4/Accounts.pm OK pod OK forbidden patterns FAIL valid Type of arg 1 to keys must be hash (not private variable) Compilation failed in require OK critic FAIL C4/Circulation.pm OK pod OK forbidden patterns FAIL valid Type of arg 1 to keys must be hash (not private variable) Compilation failed in require OK critic FAIL C4/Stats.pm OK pod OK forbidden patterns FAIL valid C4/Stats.pm had compilation errors. Type of arg 1 to keys must be hash (not private variable) OK critic FAIL t/db_dependent/Stats.t OK pod OK forbidden patterns FAIL valid Type of arg 1 to keys must be hash (not private variable) Compilation failed in require OK critic -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11230 --- Comment #10 from mathieu saby <mathsabypro@gmail.com> --- Created attachment 29666 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=29666&action=edit [PATCH 2/2] Bug 11230: dereference hashes in keys (QA followup) This followup replaces $params with %$params in keys function It also fixes some wording -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11230 mathieu saby <mathsabypro@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11230 --- Comment #11 from mathieu saby <mathsabypro@gmail.com> --- I hope I fixed it. I'm afraid beeing too far from Koha is making me forget my Perl... Mathieu -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11230 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11230 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #29158|0 |1 is obsolete| | Attachment #29666|0 |1 is obsolete| | --- Comment #12 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 30123 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=30123&action=edit [PASSED QA] Bug 11230 - Refactor C4::Stats::UpdateStats and add UT This patch - refactors C4::Stats::UpdateStats (it now takes a hashref as unique parameter, instead of a list of parameters) - add UT for it - change the calls made to this sub in C4::Accounts and C4::Circulation Additionnaly it also - adds POD to C4::Stats::TotalPaid - adds some comments to C4::Stats::TotalPaid (I think I found some errors in it) To test : 1. run "prove t/db_dependant/Stats.t -v" 2. make some circulation operations (checkout, checkin, renew, localuse) check the operations are rightly recorded in Statistics table (with a SQL query like "SELECT * FROM statistics WHERE datetime LIKE "2013-11-15%", if you run your test on the 15th november) 3. make some fine payments operations (writeoff, payment) check the operations are rightly recorded in Statistics table (with a SQL query like "SELECT * FROM statistics WHERE datetime LIKE "2013-11-15%", if you run your test on the 15th november) Note that there is probably an issue to fix in Accounts.pm : the user is saved instead of the branch. But this is not the purpose of this patch, so I kept the previous behavior for the moment. Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Work, test pass, isse/return/writeoff recorded on statistics Removed a "=back" to make happy koha-qa No other errors Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11230 --- Comment #13 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 30124 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=30124&action=edit [PASSED QA] Bug 11230: dereference hashes in keys (QA followup) This followup replaces $params with %$params in keys function It also fixes some wording Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11230 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master CC| |tomascohen@gmail.com --- Comment #14 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Patches pushed to master. Thanks Mathieu! -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11230 mathieu saby <mathsabypro@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|7021 | -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org