Created attachment 97525 [details] [review] Bug 24448: Unit tests This patch adds tests for the new method to be introduced. It also moves the tests for Koha::Biblio->subscriptions to the Biblio.t where it really belongs. To test, run this tests along with the patch implementing the new method. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 97526 [details] [review] Bug 24448: Add Koha::Biblio->subscriptions_count This patch adds the handy subscriptions_count method to the Koha::Biblio class. It is intended to be used as a shortcut for $biblio->subscriptions->count in places like the API where we can embed the output of a method. To test: 1. Apply this patches 2. Run: $ kshell k$ prove t/db_dependent/Koha/Biblio.t \ t/db_dependent/Koha/Biblios.t => SUCCESS: Tests pass! i.e. Biblios.t still passes, and the tests for the new method in Biblio.t pass as well. 3. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 97571 [details] [review] Bug 24448: Unit tests This patch adds tests for the new method to be introduced. It also moves the tests for Koha::Biblio->subscriptions to the Biblio.t where it really belongs. To test, run this tests along with the patch implementing the new method. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 97572 [details] [review] Bug 24448: Add Koha::Biblio->subscriptions_count This patch adds the handy subscriptions_count method to the Koha::Biblio class. It is intended to be used as a shortcut for $biblio->subscriptions->count in places like the API where we can embed the output of a method. To test: 1. Apply this patches 2. Run: $ kshell k$ prove t/db_dependent/Koha/Biblio.t \ t/db_dependent/Koha/Biblios.t => SUCCESS: Tests pass! i.e. Biblios.t still passes, and the tests for the new method in Biblio.t pass as well. 3. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
IMO we should not have ->subscriptions_count, but callers should ->subscriptions->count instead. What's the point of this?
(In reply to Jonathan Druart from comment #5) > IMO we should not have ->subscriptions_count, but callers should > ->subscriptions->count instead. What's the point of this? I have to admit I was a bit confused by this too - can you explain Tomas?
The short explanation is that we developed a way to embed things from the API using HTTP headers, and it can embed methods output. Take a look at this branch: https://gitlab.com/thekesolutions/Koha/tree/bug_20212_slowness_acq We could develop a way to specify we want to count things from the HTTP headers, but it is kind of overkill only for the sake of avoiding this simple method.
(In reply to Tomás Cohen Arazi from comment #7) > The short explanation is that we developed a way to embed things from the > API using HTTP headers, and it can embed methods output. Take a look at this > branch: > > https://gitlab.com/thekesolutions/Koha/tree/bug_20212_slowness_acq > > We could develop a way to specify we want to count things from the HTTP > headers, but it is kind of overkill only for the sake of avoiding this > simple method. Sorry, not understanding it yet :( What's the difference between subscriptions->count subscriptions->subscription_count in terms of the API? The first looks more standardized to me?
> > What's the difference between > > subscriptions->count > subscriptions->subscription_count > > in terms of the API? The first looks more standardized to me? Oh!.... this is a method in Biblio - that makes more sense now!
I will comment on koha-devel.
Created attachment 98033 [details] [review] Bug 24448: Unit tests This patch adds tests for the new method to be introduced. It also moves the tests for Koha::Biblio->subscriptions to the Biblio.t where it really belongs. To test, run this tests along with the patch implementing the new method. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 98034 [details] [review] Bug 24448: Add Koha::Biblio->subscriptions_count This patch adds the handy subscriptions_count method to the Koha::Biblio class. It is intended to be used as a shortcut for $biblio->subscriptions->count in places like the API where we can embed the output of a method. To test: 1. Apply this patches 2. Run: $ kshell k$ prove t/db_dependent/Koha/Biblio.t \ t/db_dependent/Koha/Biblios.t => SUCCESS: Tests pass! i.e. Biblios.t still passes, and the tests for the new method in Biblio.t pass as well. 3. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 98036 [details] [review] Bug 24448: Adding a notice to tell the _count methods are temporary See bug 24467. You are allowed to flog tcohen with an RJ45 cable if this is not fixed in the next months. Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Nice work everyone! Pushed to master for 20.05
Enhancement not backported to 19.11.x