[Bug 24435] New: Add Koha::Biblio->items_count
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24435 Bug ID: 24435 Summary: Add Koha::Biblio->items_count Change sponsored?: --- Product: Koha Version: master 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 This simple method can be used in several places. For example for embedding counts on related API objects. -- 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=24435 --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 97462 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=97462&action=edit Bug 24435: 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=24435 --- Comment #2 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 97463 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=97463&action=edit Bug 24435: Add Koha::Biblio->items_count This patch introduces a handy shortcut to get the items count for a biblio. So instead of calling: $count = $biblio->items->count; you can call: $count = $biblio->items_count; The use case for this, is when we want to embed information on objects to be sent as API responses. In that case, calling ->items->count needs to be done manually on the controller script, with interesting added complexity. With this kind of method, we can just require it to be embedded automagically by calling the following on the API: $biblio->to_api({ embed => { items_count => {} } }); If there are several nested layers of objects, doing manually can get really tricky and error prone. To test: 1. Apply this patches 2. Run: $ kshell k$ prove t/db_dependent/Koha/Biblio.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 the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24435 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | Blocks| |20212 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20212 [Bug 20212] Slowness in Receiving in Acquisitions -- 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=24435 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |agustinmoyano@theke.io, | |kyle@bywatersolutions.com, | |liz@bywatersolutions.com, | |martin.renvoize@ptfs-europe | |.com, | |nick@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24435 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.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24435 David Nind <david@davidnind.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=24435 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #97462|0 |1 is obsolete| | --- Comment #3 from David Nind <david@davidnind.com> --- Created attachment 97489 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=97489&action=edit Bug 24435: Unit tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24435 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #97463|0 |1 is obsolete| | --- Comment #4 from David Nind <david@davidnind.com> --- Created attachment 97490 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=97490&action=edit Bug 24435: Add Koha::Biblio->items_count This patch introduces a handy shortcut to get the items count for a biblio. So instead of calling: $count = $biblio->items->count; you can call: $count = $biblio->items_count; The use case for this, is when we want to embed information on objects to be sent as API responses. In that case, calling ->items->count needs to be done manually on the controller script, with interesting added complexity. With this kind of method, we can just require it to be embedded automagically by calling the following on the API: $biblio->to_api({ embed => { items_count => {} } }); If there are several nested layers of objects, doing manually can get really tricky and error prone. To test: 1. Apply this patches 2. Run: $ kshell k$ prove t/db_dependent/Koha/Biblio.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24435 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |24430 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24430 [Bug 24430] Remove C4::Biblio::CountBiblioInOrders -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24435 Nick Clemens <nick@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=24435 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #97489|0 |1 is obsolete| | Attachment #97490|0 |1 is obsolete| | --- Comment #5 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 97561 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=97561&action=edit Bug 24435: Unit tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24435 --- Comment #6 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 97562 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=97562&action=edit Bug 24435: Add Koha::Biblio->items_count This patch introduces a handy shortcut to get the items count for a biblio. So instead of calling: $count = $biblio->items->count; you can call: $count = $biblio->items_count; The use case for this, is when we want to embed information on objects to be sent as API responses. In that case, calling ->items->count needs to be done manually on the controller script, with interesting added complexity. With this kind of method, we can just require it to be embedded automagically by calling the following on the API: $biblio->to_api({ embed => { items_count => {} } }); If there are several nested layers of objects, doing manually can get really tricky and error prone. To test: 1. Apply this patches 2. Run: $ kshell k$ prove t/db_dependent/Koha/Biblio.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24435 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |20.05.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24435 --- Comment #7 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Nice work everyone! Pushed to master for 20.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24435 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=24448 CC| |jonathan.druart@bugs.koha-c | |ommunity.org -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24435 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |24467 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24467 [Bug 24467] *_count methods should be avoided -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24435 Bug 24435 depends on bug 24430, which changed state. Bug 24430 Summary: Remove C4::Biblio::CountBiblioInOrders https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24430 What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to master |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24435 Joy Nelson <joy@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED CC| |joy@bywatersolutions.com Status|Pushed to master |RESOLVED --- Comment #8 from Joy Nelson <joy@bywatersolutions.com> --- enhancement not backported to 19.11.x -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org