[Bug 29757] New: Add filter_by_non_reversable/reversable methods for offsets
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 Bug ID: 29757 Summary: Add filter_by_non_reversable/reversable methods for offsets Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com QA Contact: testopia@bugs.koha-community.org Taking this methods out of bug 28656 for reusing them, with Martin's approval. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 128865 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=128865&action=edit Bug 29757: Unit tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 --- Comment #2 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 128866 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=128866&action=edit Bug 29757: Add filters for reversable offsets This patch adds filtering methods for (non)reversable offsets. To test: 1. Apply this patches 2. Run: $ kshell k$ prove t/db_dependent/Koha/Account/Offsets.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 --- Comment #3 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 128867 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=128867&action=edit Bug 29757: (QA follow-up) POD fixes This patch adds POD, fixes the existing one in the file, and also renames reversable => reversible as required by the QA scripts. If this name change is problematic, I can revert it and resubmit my follow-up. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |28656 Assignee|koha-bugs@lists.koha-commun |martin.renvoize@ptfs-europe |ity.org |.com Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28656 [Bug 28656] Cancellations should be allowed on paid/partially paid debts -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |27946 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27946 [Bug 27946] Add a charge per article request to patron categories -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|27946 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27946 [Bug 27946] Add a charge per article request to patron categories -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |29759 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29759 [Bug 29759] Revert credit when cancelling an article request -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kyle@bywatersolutions.com, | |m.de.rooy@rijksmuseum.nl -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Add |Add |filter_by_non_reversable/re |filter_by_non_reversible/re |versable methods for |versible methods for |offsets |offsets -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 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.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #128865|0 |1 is obsolete| | Attachment #128866|0 |1 is obsolete| | Attachment #128867|0 |1 is obsolete| | --- Comment #4 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 129150 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=129150&action=edit Bug 29757: Unit tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 --- Comment #5 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 129151 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=129151&action=edit Bug 29757: Add filters for reversable offsets This patch adds filtering methods for (non)reversable offsets. To test: 1. Apply this patches 2. Run: $ kshell k$ prove t/db_dependent/Koha/Account/Offsets.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 --- Comment #6 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 129152 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=129152&action=edit Bug 29757: (QA follow-up) POD fixes This patch adds POD, fixes the existing one in the file, and also renames reversable => reversible as required by the QA scripts. If this name change is problematic, I can revert it and resubmit my follow-up. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #129150|0 |1 is obsolete| | --- Comment #7 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 129178 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=129178&action=edit Bug 29757: Unit tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #129151|0 |1 is obsolete| | --- Comment #8 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 129179 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=129179&action=edit Bug 29757: Add filters for reversable offsets This patch adds filtering methods for (non)reversable offsets. To test: 1. Apply this patches 2. Run: $ kshell k$ prove t/db_dependent/Koha/Account/Offsets.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #129152|0 |1 is obsolete| | --- Comment #9 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 129180 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=129180&action=edit Bug 29757: (QA follow-up) POD fixes This patch adds POD, fixes the existing one in the file, and also renames reversable => reversible as required by the QA scripts. If this name change is problematic, I can revert it and resubmit my follow-up. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 --- Comment #10 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- All looks good to me, adding my accounts hat stamp here too. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 --- Comment #11 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> ---
Bug 29757: Add filters for reversable offsets
https://whichiscorrect.com/reversible-or-reversable/ -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 --- Comment #12 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Marcel de Rooy from comment #11)
Bug 29757: Add filters for reversable offsets
Right, the original implementation used reversable. I think I forgot to correct the commit subject -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |BLOCKED --- Comment #13 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Still looking here a bit. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|BLOCKED |Passed QA --- Comment #14 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- What I still have trouble with here most, is that the two filter methods have a generic name but they relate to debits. We could use: my $total_reversible = $debit->debit_offsets->filter_by_reversible->total; But what if we want to filter credits? my $total_reversible = $credit->credit_offsets->filter_by_reversible->total; That would make no sense; the code refers to credit_id and amount < 0. So, in other words, does the name really reflect what we are doing? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 --- Comment #15 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Marcel de Rooy from comment #14)
What I still have trouble with here most, is that the two filter methods have a generic name but they relate to debits.
We could use: my $total_reversible = $debit->debit_offsets->filter_by_reversible->total;
But what if we want to filter credits? my $total_reversible = $credit->credit_offsets->filter_by_reversible->total; That would make no sense; the code refers to credit_id and amount < 0.
So, in other words, does the name really reflect what we are doing?
I agree. Martin and I have been talking about subclassing Koha::Acount::Line(s) so we have proper classes for debits and credits. In that case, we could move those methods there. I'm fine with a method name change. I ran out of ideas, though. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 --- Comment #16 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 129296 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=129296&action=edit Bug 29757: (QA follow-up) Remove abs from the test Obviously abs has two sides, and we could allow wrong results. We can be more precise here. Trivial exercise. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #129296|0 |1 is obsolete| | --- Comment #17 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Comment on attachment 129296 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=129296 Bug 29757: (QA follow-up) Remove abs from the test Oops -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m --- Comment #18 from Fridolin Somers <fridolin.somers@biblibre.com> --- The only difference between the two methods is "-not_in". Could be make a private method called by those two to avoid duplicate code ? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 --- Comment #19 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Fridolin Somers from comment #18)
The only difference between the two methods is "-not_in". Could be make a private method called by those two to avoid duplicate code ?
Good idea. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Failed QA Keywords| |additional_work_needed --- Comment #20 from Fridolin Somers <fridolin.somers@biblibre.com> --- Martin, on it ? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 --- Comment #21 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Fridolin Somers from comment #18)
The only difference between the two methods is "-not_in". Could be make a private method called by those two to avoid duplicate code ?
I generally agree, but it is a really small query... And generalizing it might end up obfuscating the code with not much gain. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|additional_work_needed | Status|Failed QA |Passed QA --- Comment #22 from Fridolin Somers <fridolin.somers@biblibre.com> --- OK gain is really small. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |22.05.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 --- Comment #23 from Fridolin Somers <fridolin.somers@biblibre.com> --- Pushed to master for 22.05, thanks to everybody involved 🦄 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29757 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to master |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org