bywatersolutions / koha-plugin-coverflow

Cover Flow plugin for Koha
12 stars 15 forks source link

HTML incorrectly formed if there is only 1 result in report #44

Open minusdavid opened 3 years ago

minusdavid commented 3 years ago

Plugin version: v2.4.47

A librarian noticed that the word spacing is incorrect for their coverflow output when there is only 1 result.

The "ul.flipstercontainer" element is created correctly, but its child "li" element doesn't have any flipster classes and there is no "div.flipsteritem__content" element.

minusdavid commented 2 years ago

One way to get around this is to use a report that is likely to always output at least 2 results.

Here's a report that will show a random selection of the 30 records with new items: SELECT * FROM ( SELECT b.biblionumber, SUBSTRING_INDEX(m.isbn, ' ', 1) AS isbn, b.title, max(i.dateaccessioned) as dateacc FROM items i LEFT JOIN biblioitems m USING (biblioitemnumber) LEFT JOIN biblio b ON (i.biblionumber=b.biblionumber) WHERE m.isbn IS NOT NULL AND m.isbn != '' GROUP BY biblionumber HAVING isbn != "" ORDER BY dateacc desc LIMIT 30 ) u ORDER BY rand()

minusdavid commented 2 years ago

Ah foiled... this works in the mysql client but it works differently in Koha. I seem to recall reading something about this...

minusdavid commented 2 years ago

Here we go. Because MySQL is weird:

SELECT * FROM ( SELECT b.biblionumber, SUBSTRING_INDEX(m.isbn, ' ', 1) AS isbn, b.title, max(i.dateaccessioned) FROM items i LEFT JOIN biblioitems m USING (biblioitemnumber) LEFT JOIN biblio b ON (i.biblionumber=b.biblionumber) WHERE m.isbn IS NOT NULL AND m.isbn != '' GROUP BY biblionumber HAVING isbn != "" ORDER BY max(i.dateaccessioned) desc LIMIT 30 ) subq ORDER BY rand() LIMIT 30

minusdavid commented 2 months ago

I think this might be the latest query that includes cover images...

SELECT * FROM ( SELECT b.biblionumber, SUBSTRING_INDEX(m.isbn, ' ', 1) AS isbn, b.title, max(i.dateaccessioned), c.biblionumber as localcover FROM items i LEFT JOIN biblioitems m USING (biblioitemnumber) LEFT JOIN biblio b ON (i.biblionumber=b.biblionumber) LEFT OUTER JOIN cover_images c ON (i.biblionumber = c.biblionumber) WHERE m.isbn IS NOT NULL AND m.isbn != '' GROUP BY biblionumber HAVING isbn != "" ORDER BY max(i.dateaccessioned) desc LIMIT 30 ) subq ORDER BY rand() LIMIT 30