Bug 25110

Summary: Allow patrons to add star ratings to titles on their summary/checkout page
Product: Koha Reporter: Kelly McElligott <kelly>
Component: OPACAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: 1joynelson, david, eveal
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This enhancement lets logged-in patrons add star ratings to titles listed on their current checkouts and reading history pages.
Version(s) released in:
20.05.00
Attachments: Bug 25110: Allow patrons to add star ratings to titles on their summary/checkout page
Bug 25110: Allow patrons to add star ratings to titles on their summary/checkout page
Screenshot of ratings on user account page
Screenshot of ratings on reading history page
Bug 25110: Allow patrons to add star ratings to titles on their summary/checkout page
Bug 25110: Allow patrons to add star ratings to titles on their summary/checkout page
Bug 25110: Allow patrons to add star ratings to titles on their summary/checkout page
Bug 25110: (QA follow-up) Add aria-hidden="true" to FA icons

Description Kelly McElligott 2020-04-10 19:44:06 UTC

    
Comment 1 Kelly McElligott 2020-04-10 19:45:24 UTC
It would be very nice if a patron could add their star rating to a book that they have currently checked out.  Generally, a patron will want to star a book once they have read it versus looking for a book in the catalog. Currently, a patron can only star a book from the Record view.
Comment 2 Owen Leonard 2020-04-14 18:06:59 UTC Comment hidden (obsolete)
Comment 3 Kelly McElligott 2020-04-14 23:37:16 UTC
I can see the "Rate Me" button on the account summary on a checked-out item, however, clicking the button does not do anything.  It tries to do something, but nothing changes.  

On a side note, I did have a hard time finding this "Rate me" button and wondered if either it should be in line with the text "Average Rating" and/or had stars next to it to indicate that there was the ability to star the book.
Comment 4 Owen Leonard 2020-04-15 15:45:20 UTC Comment hidden (obsolete)
Comment 5 Owen Leonard 2020-04-15 15:49:13 UTC
(In reply to Kelly McElligott from comment #3)
> I can see the "Rate Me" button on the account summary on a checked-out item

Thanks for testing Kelly. If you saw a "Rate me" button you either had JavaScript disabled or there was a JavaScript error on the page. If you can test again, please clear your browser cache after applying the patch.

I modified the patch to remove the non-js functionality because it conflicted with the form wrapping the table of checkouts. If you disable JavaScript in your browser you should see the rating information but not see any controls.
Comment 6 Kelly McElligott 2020-04-15 20:43:03 UTC
Ah!  I see now Owen!  Yes, it is working however, I would like to talk about keeping the rating system consistent with how it looks in the results page, where the user can hover over the stars and rate the book.  I think for the user to see stars, they understand that it can be rated?!

Just my thoughts on this!

Kelly
Comment 7 Ed Veal 2020-04-15 22:42:12 UTC
When I tested this I saw the "stars" briefly then the empty dropdown appeared with the "rate me" button next to it. There were rating numbers in the dropdown but you had to click on the dropdown to see them. I agree with Kelly that this really needs to appear the same as the other rating points. I am sure you are working on that and I think this is a great enhancement. Keep it up! 

Ed
Comment 8 Owen Leonard 2020-04-15 23:16:20 UTC
The ratings feature has never allowed the user to set a rating on the search results page. To make that change is certainly possible but I would consider it out of scope for this bug.

Ed: Did you clear your browser cache after applying the patch?
Comment 9 Kelly McElligott 2020-04-16 11:42:22 UTC
Hi Owen, 
I misspoke, I meant to keep the star ratings consistent to the full record view in the catalog.  To have the user see the 5 stars and rate the same way would be great.  Having a dropdown with numbers has a different look and may not be as intuitive to the user. 

thanks for working on this.
Comment 10 Owen Leonard 2020-04-16 12:40:50 UTC
Created attachment 103080 [details]
Screenshot of ratings on user account page
Comment 11 Owen Leonard 2020-04-16 12:41:16 UTC
Created attachment 103081 [details]
Screenshot of ratings on reading history page
Comment 12 Owen Leonard 2020-04-16 12:43:31 UTC
(In reply to Kelly McElligott from comment #9)
> Having a dropdown with numbers has a different look and may
> not be as intuitive to the user. 

Please see the attached screenshots. If you see a dropdown something has gone wrong. Can you look for JavaScript errors in the browser console?
Comment 13 David Nind 2020-04-21 07:52:40 UTC
I get the same thing. The JavaScript error in the console is:

Google Chrome:
DevTools failed to load SourceMap: Could not load content for http://127.0.0.1:8080/opac-tmpl/lib/jquery/plugins/jquery.barrating.min.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

Firefox:
Source map error: Error: request failed with status 404
Resource URL: http://127.0.0.1:8080/opac-tmpl/lib/jquery/plugins/jquery.barrating.min_19.1200077.js
Source Map URL: jquery.barrating.min.js.map

In both cases cached cleared in browser, flush_memcached and restart_all in koha-testing-docker after applying the patch.
Comment 14 Owen Leonard 2020-04-21 12:00:50 UTC
Created attachment 103365 [details] [review]
Bug 25110: Allow patrons to add star ratings to titles on their summary/checkout page

This patch adds the ability for logged-in patrons to add star ratings to
titles in their list of current checkouts and on the reading history
page.

The reading history page previously only showed existing ratings. Now it
will allow the entry of ratings as well.

The JS and markup for the feature are in separate include files to
facilitate re-use. It includes markup for non-js display of ratings and
js-driven ratings controls.

To test, apply the patch and set the OpacStarRatings to all, "results,
details, and user" pages.

 - Log in to the OPAC as a user with checkouts.
 - On the "your summary" page, test the features of setting star
   ratings:
   - Any title with existing ratings should show the rating and the
     average rating number.
   - Set a rating. Confirm that it shows a message with your rating.
   - Click the "cancel rating" link, and confirm that your rating is
     removed.
   - Set a rating and reload the page. Confirm that the rating was
     saved.
   - Test the "cancel rating" link on the title you set before you
     reloaded the page. The rating should be cancelled.
 - Test the same functionality on the "your reading history" page.
 - Test these pages with the  OpacStarRatings preference set to "only
   details" or "no." The pages should function correctly.

Edit: Add JS file which was missing from the commit!
Comment 15 David Nind 2020-04-21 19:27:31 UTC
Created attachment 103405 [details] [review]
Bug 25110: Allow patrons to add star ratings to titles on their summary/checkout page

This patch adds the ability for logged-in patrons to add star ratings to
titles in their list of current checkouts and on the reading history
page.

The reading history page previously only showed existing ratings. Now it
will allow the entry of ratings as well.

The JS and markup for the feature are in separate include files to
facilitate re-use. It includes markup for non-js display of ratings and
js-driven ratings controls.

To test, apply the patch and set the OpacStarRatings to all, "results,
details, and user" pages.

 - Log in to the OPAC as a user with checkouts.
 - On the "your summary" page, test the features of setting star
   ratings:
   - Any title with existing ratings should show the rating and the
     average rating number.
   - Set a rating. Confirm that it shows a message with your rating.
   - Click the "cancel rating" link, and confirm that your rating is
     removed.
   - Set a rating and reload the page. Confirm that the rating was
     saved.
   - Test the "cancel rating" link on the title you set before you
     reloaded the page. The rating should be cancelled.
 - Test the same functionality on the "your reading history" page.
 - Test these pages with the  OpacStarRatings preference set to "only
   details" or "no." The pages should function correctly.

Edit: Add JS file which was missing from the commit!

Signed-off-by: David Nind <david@davidnind.com>
Comment 16 Katrin Fischer 2020-04-25 22:57:59 UTC
Caught by the new QA tools check: 

 FAIL	koha-tmpl/opac-tmpl/bootstrap/en/includes/user-star-ratings.inc
   OK	  filters
   FAIL	  forbidden patterns
		forbidden pattern: Font Awesome icons need the aria-hidden attribute for accessibility purpose (see bug 25166)  (line 45)
		forbidden pattern: Font Awesome icons need the aria-hidden attribute for accessibility purpose (see bug 25166)  (line 49)

Will try to provide a follow-up later.
Comment 17 Katrin Fischer 2020-04-25 23:24:58 UTC
Created attachment 103718 [details] [review]
Bug 25110: Allow patrons to add star ratings to titles on their summary/checkout page

This patch adds the ability for logged-in patrons to add star ratings to
titles in their list of current checkouts and on the reading history
page.

The reading history page previously only showed existing ratings. Now it
will allow the entry of ratings as well.

The JS and markup for the feature are in separate include files to
facilitate re-use. It includes markup for non-js display of ratings and
js-driven ratings controls.

To test, apply the patch and set the OpacStarRatings to all, "results,
details, and user" pages.

 - Log in to the OPAC as a user with checkouts.
 - On the "your summary" page, test the features of setting star
   ratings:
   - Any title with existing ratings should show the rating and the
     average rating number.
   - Set a rating. Confirm that it shows a message with your rating.
   - Click the "cancel rating" link, and confirm that your rating is
     removed.
   - Set a rating and reload the page. Confirm that the rating was
     saved.
   - Test the "cancel rating" link on the title you set before you
     reloaded the page. The rating should be cancelled.
 - Test the same functionality on the "your reading history" page.
 - Test these pages with the  OpacStarRatings preference set to "only
   details" or "no." The pages should function correctly.

Edit: Add JS file which was missing from the commit!

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 18 Katrin Fischer 2020-04-25 23:25:03 UTC
Created attachment 103719 [details] [review]
Bug 25110: (QA follow-up) Add aria-hidden="true" to FA icons

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 19 Martin Renvoize 2020-04-29 16:36:08 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 20 Joy Nelson 2020-05-08 22:30:30 UTC
enhancement not backported to 19.11