Bug 24554 - Only embed relations from Koha::Biblio in to_api
Summary: Only embed relations from Koha::Biblio in to_api
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: REST API (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Tomás Cohen Arazi
QA Contact:
URL:
Keywords:
Depends on: 24366 24528
Blocks: 20212
  Show dependency treegraph
 
Reported: 2020-01-31 12:05 UTC by Tomás Cohen Arazi
Modified: 2020-03-05 00:25 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:
20.05.00


Attachments
Bug 24554: Only embed relations from Koha::Biblio in to_api (1.61 KB, patch)
2020-01-31 12:11 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 24554: Only embed relations from Koha::Biblio in to_api (1.65 KB, patch)
2020-02-01 20:23 UTC, David Nind
Details | Diff | Splinter Review
Bug 24554: Only embed relations from Koha::Biblio in to_api (1.73 KB, patch)
2020-02-06 09:19 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2020-01-31 12:05:00 UTC
The current implemented behaviour of this method (fallback to the biblioitems relations) breaks using it with bug 24538. On fixing it, I noticed the method is quite over-engineered.

As biblioitems is not a real entity on the API and we are not going to add related tables to bilbioitems (most probably get it merged into biblio) we don't need the pass-through of embeds into the biblioitem object.

This makes counts work, and also makes sense :-D
Comment 1 Tomás Cohen Arazi 2020-01-31 12:11:20 UTC
Created attachment 98225 [details] [review]
Bug 24554: Only embed relations from Koha::Biblio in to_api

This patch simplifies the behaviour of Koha::Biblio->to_api. It was
designed with the idea of handling possible methods that would be added
to Koha::Biblioitem. But it had a weird fallback behaviour was
highlighted by using it with bug 24528.

On fixing it it become obvious that it was unnessessarily complex and
that it was not worth. That's the reason there wasn't any test for it,
as Koha::Biblioitem doesn't implement any extra methods.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Biblio.t
=> SUCCESS: Tests pass
2. Apply this patch
3. Repeat (1)
=> SUCCESS: Tests pass!
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 2 David Nind 2020-02-01 20:23:22 UTC
Created attachment 98266 [details] [review]
Bug 24554: Only embed relations from Koha::Biblio in to_api

This patch simplifies the behaviour of Koha::Biblio->to_api. It was
designed with the idea of handling possible methods that would be added
to Koha::Biblioitem. But it had a weird fallback behaviour was
highlighted by using it with bug 24528.

On fixing it it become obvious that it was unnessessarily complex and
that it was not worth. That's the reason there wasn't any test for it,
as Koha::Biblioitem doesn't implement any extra methods.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Biblio.t
=> SUCCESS: Tests pass
2. Apply this patch
3. Repeat (1)
=> SUCCESS: Tests pass!
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 Jonathan Druart 2020-02-06 09:19:22 UTC
Created attachment 98519 [details] [review]
Bug 24554: Only embed relations from Koha::Biblio in to_api

This patch simplifies the behaviour of Koha::Biblio->to_api. It was
designed with the idea of handling possible methods that would be added
to Koha::Biblioitem. But it had a weird fallback behaviour was
highlighted by using it with bug 24528.

On fixing it it become obvious that it was unnessessarily complex and
that it was not worth. That's the reason there wasn't any test for it,
as Koha::Biblioitem doesn't implement any extra methods.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Biblio.t
=> SUCCESS: Tests pass
2. Apply this patch
3. Repeat (1)
=> SUCCESS: Tests pass!
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 4 Martin Renvoize 2020-02-06 12:38:01 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 5 Joy Nelson 2020-03-05 00:25:51 UTC
Not pushed to 19.11.x due to dependencies