Bug 24957 - OpenLibrarySearch shouldnt display if nothing is returned
Summary: OpenLibrarySearch shouldnt display if nothing is returned
Status: Pushed to oldstable
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: master
Hardware: All All
: P5 - low minor (vote)
Assignee: Lucas Gass
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-23 18:27 UTC by Lucas Gass
Modified: 2020-05-14 21:04 UTC (History)
2 users (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, 19.11.06, 19.05.11


Attachments
Bug 24957: OpenLibrarySearch shouldnt display if nothing is returned (1.19 KB, patch)
2020-04-21 20:12 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 24957: OpenLibrarySearch shouldnt display if nothing is returned (1.25 KB, patch)
2020-04-21 20:58 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 24957: OpenLibrarySearch shouldnt display if nothing is returned (1.31 KB, patch)
2020-04-22 22:44 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Lucas Gass 2020-03-23 18:27:50 UTC
If you turn on OpenLibrarySearch results are often not returned and only the text "Open Library:" displays.

Firstly, if there is nothing to return we should display nothing.

Secondly, it does look like any of these records do return data but the API has changed, I think. Koha checks to see if "items:	[]" has length and returns false if this is true.

But I am finding many records where the data seems to be present: (https://openlibrary.org/api/volumes/brief/json/id:0;isbn:067002662X;lccn:__2012035454) but items contains nothing. 

I don't know anything about the OpenLibrary API, but perhaps it has changed.

TO RECREATE:
1. turn on OpenLibrarySearch
2. go to the opac results page and opac details page and see many records that just display "Open Library: " and nothing else.
Comment 1 Heather 2020-03-23 19:24:46 UTC
This search in our 19.05 catalog shows several items with the text "Open Library:       " where OpenLibrary actually has the item:
https://keys.bywatersolutions.com/cgi-bin/koha/opac-search.pl?q=cachalot

E.g., also, these records:
https://keys.bywatersolutions.com/cgi-bin/koha/opac-detail.pl?biblionumber=13955&query_desc=cachalot

https://keys.bywatersolutions.com/cgi-bin/koha/opac-detail.pl?biblionumber=13954&query_desc=fiction

From those records in our catalog you can select "More searches," and the "Open Library..." search, you are taken to the Open Library where there are copies to borrow.
Comment 2 Lucas Gass 2020-04-21 20:00:39 UTC
Upon further review I don't think the API has changed. According to https://openlibrary.org/dev/docs/api/read, if items is empty "Thw list may be empty if nothing's available."

So when no items are available we should not display the ol_readapi_book class in the search results or details. If we do all that displays is 'Open Library:' with nothing else. That seems confusing.
Comment 3 Lucas Gass 2020-04-21 20:12:29 UTC
Created attachment 103417 [details] [review]
Bug 24957: OpenLibrarySearch shouldnt display if nothing is returned

TO TEST:
1. Turn on OpenLibrarySearch
2. Do an OPAC search that returns results that have results with Open Library results and some that do not.
3. Notice results that return nothing simpliy say "Open Library:" with nothing afterwards.
4. Some results return a png from OpenLibrary or "Not found"
5. Apply patch and look at records again.
6. The results that return nothing for OpenLibrary API should now to hidden.
Comment 4 ByWater Sandboxes 2020-04-21 20:58:28 UTC
Created attachment 103419 [details] [review]
Bug 24957: OpenLibrarySearch shouldnt display if nothing is returned

TO TEST:
1. Turn on OpenLibrarySearch
2. Do an OPAC search that returns results that have results with Open Library results and some that do not.
3. Notice results that return nothing simpliy say "Open Library:" with nothing afterwards.
4. Some results return a png from OpenLibrary or "Not found"
5. Apply patch and look at records again.
6. The results that return nothing for OpenLibrary API should now to hidden.

Signed-off-by: Heather Hernandez <heather_hernandez@nps.gov>
Comment 5 Heather 2020-04-21 21:02:06 UTC
I used a sandbox and was able to re-create the problem with the keyword search:
first

Some of the results had the problem display, "Open Library:       " and some results displayed "Open Library: Not found," and there was also the correct display, "Open Library Read Now."

I then applied the patch, and the problematic "Open Library:      " disappeared--there were still some libraries that said, "Open Library: Not found" and a record with the correct display, "Open Library Read Now."  So I went ahead and signed off, because the problematic display disappeared.

But this is my first real sign off, so please comment to let me know if I missed something, or if the "Open Library: Not found" should have also disappeared.  Thanks!
Comment 6 Katrin Fischer 2020-04-22 22:39:36 UTC
Hi Heather, thx for testing this! Hope it will be only the first to be followed by many more :)
Comment 7 Katrin Fischer 2020-04-22 22:44:05 UTC
Created attachment 103518 [details] [review]
Bug 24957: OpenLibrarySearch shouldnt display if nothing is returned

TO TEST:
1. Turn on OpenLibrarySearch
2. Do an OPAC search that returns results that have results with Open Library results and some that do not.
3. Notice results that return nothing simpliy say "Open Library:" with nothing afterwards.
4. Some results return a png from OpenLibrary or "Not found"
5. Apply patch and look at records again.
6. The results that return nothing for OpenLibrary API should now to hidden.

Signed-off-by: Heather Hernandez <heather_hernandez@nps.gov>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 8 Heather 2020-04-23 20:14:13 UTC
It was actually fun, Katrin!  I'll be looking for more to do in the future!!
Comment 9 Katrin Fischer 2020-04-24 20:23:21 UTC
(In reply to Heather from comment #8)
> It was actually fun, Katrin!  I'll be looking for more to do in the future!!

Glad to hear that :) Don't hesitate to get in touch (on IRC or by email) if you need any help!
Comment 10 Martin Renvoize 2020-04-27 10:24:48 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 11 Joy Nelson 2020-05-08 20:57:24 UTC
Backported to 19.11.x for 19.11.06
Comment 12 Lucas Gass 2020-05-14 21:04:06 UTC
backported to 19.05.x for 19.05.11