Topic Ratings Plugin

Hey I love this plugin. Thanks for the good work. How about showing the rating on hover over the stars in each topic / posts? For example can show 3.5 or 4.2 numbers based on average rating. I have the Show exact average rating setting turned on.

Sorry for the slow reply, Iā€™ve been away.

Just to clarify, you are seeing the numerical average next to the topic rating right?

Could you show me a mockup or an example of what you have in mind? Cheers.

Yes, I see the average. Thatā€™s fine. What I have in mind is a Amazon.com like hover on small title popup showing the average on the main topics list view. In that screen you see a rating but on hover does not show the average. For example, a 3.5 rating is showing as 4 stars and on hover does not give out the average. I have to enter that topic to view the average. Understand it is not a big deal to have it as it is, just thought since we are accustomed to hovering over star ratings on many websites to see the average score, it may be a good feature to implement for habitual reasons.

1 Like

When the topic creator has chosen no rating for a topic, why donā€™t we suppress the need to either add a rating or uncheck the box for replies? We can just hide the ratings field for the replies right?

Iā€™ve added exact averages to topic list items in the same format as in the topic title.

I didnā€™t do the Amazon-style hover (yet) because a hover element typically holds more content than just a single number (unless itā€™s a tooltip), and Iā€™ll need to decide what else to include there first.

One option is to add the percentages for the different star options like Amazon does (see below).

Also, I had a brief look around at other popular sites using star ratings. It seems a majority display the number of ratings after the stars, with a minority showing the exact average. Not many show anything on hover.

Were there any other specific examples you had in mind?

https://github.com/angusmcleod/discourse-ratings/commit/fc78122d0dd3d3de1fe5ff9483413f1de637819b

4 Likes

Could you give a little more info for this scenario:

  1. Is the topic in a category with ratings turned on and/or has a ā€˜ratingā€™ tag?

  2. Which ratings ā€˜fieldā€™ are we hiding?

Yes, the topic is in a category with ratings turned on. I will give you an example.

As a topic creator, I post a new topic under this category but uncheck ratings while posting it.

Now another user is replying to this topic without ratings (but under a category with ratings enabled)

The user has to now again either uncheck ratings while posting his reply or has to add a rating.

I wonder if we can (or should) suppress the need to add/uncheck a rating for replies to a topic which the owner of the topic has not set ratings to. I cannot think of any scenario where it may be needed to add a rating to a reply for an original topic without ratings.

Hi!

I triied to install this plugin but seems like something is wrong, i canā€™t rate a topic and got this in error logs :slight_smile:

Error: Could not find module `discourse/helpers/register-unbound` imported from `discourse/plugins/discourse-ratings/discourse/initializers/ratings-edits`
    at o (https://forum.hsfactory.net/assets/vendor-6c83cefb781b3fa325bff76e9ba637bf719260cc7353ee0179cd706e79535999.js:1:16235)
    at i (https://forum.hsfactory.net/assets/vendor-6c83cefb781b3fa325bff76e9ba637bf719260cc7353ee0179cd706e79535999.js:1:16160)
    at n.state (https://forum.hsfactory.net/assets/vendor-6c83cefb781b3fa325bff76e9ba637bf719260cc7353ee0179cd706e79535999.js:1:17303)
    at e (https://forum.hsfactory.net/assets/vendor-6c83cefb781b3fa325bff76e9ba637bf719260cc7353ee0179cd706e79535999.js:1:15619)
    at requireModule (https://forum.hsfactory.net/assets/vendor-6c83cefb781b3fa325bff76e9ba637bf719260cc7353ee0179cd706e79535999.js:1:17288)
    at https://forum.hsfactory.net/assets/application-e93a5eb8d40d078353f1408a62dde9404648a0ef8e6cdf28483c04667dd5e36b.js:1:3894
    at Array.forEach (native)
    at window.Discourse.Ember.Application.extend.start (https://forum.hsfactory.net/assets/application-e93a5eb8d40d078353f1408a62dde9404648a0ef8e6cdf28483c04667dd5e36b.js:1:3837)
    at https://forum.hsfactory.net/:487:13
1 Like

@repz I just updated this plugin to work with the latest Discourse code. Please try again. Thanks.

https://github.com/angusmcleod/discourse-ratings/commit/b77ed1068018fd107a4a4c8ac35af57666ac6884

3 Likes

@angus working like a charm!

Thanks a lot :wink:

2 Likes

This is great! Iā€™d like to use it with the Discourse WordPress plugin so that WooCommerce (a WordPress ecommerce plugin) product reviews can be written on Discourse. Does anyone have any ideas on what needs to be done to return the rating and average_rating fields with the information returned from wordpress.json?


Edit:
Iā€™ve got it working by returning the topic custom fields through the TopicViewWordpressSerializer and the post custom fields through the PostWordpressSerializer.

4 Likes

Nice. Let me know if you have any other issues.

1 Like

Hi. I got the following fatal error after rebuilding the app. I am running v1.6.0.beta9 +16. No rating box shows up when creating new topics or posts. Thanks

NoMethodError (undefined method custom_fields' for nil:NilClass) /var/www/discourse/plugins/discourse-ratings/plugin.rb:55:incalculate_topic_averageā€™

@doserved I just made a slight change, could you test it again? If it fails again please post as much of the log here as possible.

Thanks.

https://github.com/angusmcleod/discourse-ratings/commit/450f528e5b52248a6082863c3a3b146bf927b099

1 Like

Angus,

It works now. Thanks for making the fix!

David

1 Like

Italian translation
client.it.yml (469 Bytes)

2 Likes

Cool, if you make it a PR Iā€™ll add it to the repo.

Hi:

Thanks for your efforts.

I have tried to install stable version and master version on the newest discourse version, it cannot work for me. Can this plugin compatible with the discourse master version which has already tag plugin embeded. 

Looking forward to your reply.

Hey, are you seeing any errors in the console? or in /logs ?

I just download the code from github into directory discourse/plugins/.

I use the develoment environment.