# Topic Ratings Plugin

**URL:** https://meta.discourse.org/t/topic-ratings-plugin/39578
**Category:** Plugin
**Tags:** pavilion
**Created:** [14.Февраль.2016 21:06:53 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578 "2016-02-14T21:06:53Z")
**Posts on this page:** 20
**Page:** 3

<div class="post-metadata">

### Author: ![envieme](https://avatars.discourse-cdn.com/v4/letter/e/da6949/32.png) [@envieme](https://meta.discourse.org/u/envieme)
#### Post date: [22.Апрель.2016 11:43:54 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/41 "2016-04-22T11:43:54Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [02.Май.2016 00:39:49 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/42 "2016-05-02T00:39:49Z")

</div>

Sorry for the slow reply, I’ve been away.

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

 ![](https://global.discourse-cdn.com/meta/original/3X/e/b/ebb78de32261c86aa8d3036870b2e22094bcf53a.png)

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

---

<div class="post-metadata">

### Author: ![envieme](https://avatars.discourse-cdn.com/v4/letter/e/da6949/32.png) [@envieme](https://meta.discourse.org/u/envieme)
#### Post date: [14.Май.2016 18:49:40 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/43 "2016-05-14T18:49:40Z")

</div>

Yes, I see the average. That’s fine. What I have in mind is a [Amazon.com](http://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.

---

<div class="post-metadata">

### Author: ![envieme](https://avatars.discourse-cdn.com/v4/letter/e/da6949/32.png) [@envieme](https://meta.discourse.org/u/envieme)
#### Post date: [14.Май.2016 18:50:50 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/44 "2016-05-14T18:50:50Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [18.Май.2016 02:43:42 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/45 "2016-05-18T02:43:42Z")

</div>

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://global.discourse-cdn.com/meta/original/3X/1/e/1e0b912cb02f7849f754449df8741c9b53c0d406.png)

 ![](https://global.discourse-cdn.com/meta/original/3X/b/b/bbd687d887731ac6513c49d75937df650daf969e.png)

 ![](https://global.discourse-cdn.com/meta/original/3X/2/e/2e768aab98197507b1a3429d207b804522c3f234.png)

[https://github.com/angusmcleod/discourse-ratings/commit/fc78122d0dd3d3de1fe5ff9483413f1de637819b](https://github.com/angusmcleod/discourse-ratings/commit/fc78122d0dd3d3de1fe5ff9483413f1de637819b)

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [18.Май.2016 02:47:10 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/46 "2016-05-18T02:47:10Z")

</div>

> [@envieme](#):
>
> 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?

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?

---

<div class="post-metadata">

### Author: ![envieme](https://avatars.discourse-cdn.com/v4/letter/e/da6949/32.png) [@envieme](https://meta.discourse.org/u/envieme)
#### Post date: [22.Май.2016 14:47:05 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/47 "2016-05-22T14:47:05Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![repz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/repz/32/121758_2.png) [@repz](https://meta.discourse.org/u/repz)
#### Post date: [23.Май.2016 07:07:00 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/48 "2016-05-23T07:07:00Z")

</div>

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 🙂

```
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

```

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [23.Май.2016 16:55:04 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/49 "2016-05-23T16:55:04Z")

</div>

@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](https://github.com/angusmcleod/discourse-ratings/commit/b77ed1068018fd107a4a4c8ac35af57666ac6884)

---

<div class="post-metadata">

### Author: ![repz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/repz/32/121758_2.png) [@repz](https://meta.discourse.org/u/repz)
#### Post date: [23.Май.2016 20:47:46 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/50 "2016-05-23T20:47:46Z")

</div>

@angus working like a charm!

Thanks a lot 😉

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [30.Май.2016 16:42:19 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/51 "2016-05-30T16:42:19Z")

</div>

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`.

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [31.Май.2016 14:20:30 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/52 "2016-05-31T14:20:30Z")

</div>

> [@simon](#):
>
> I’ve got it working by returning the topic custom fields through the TopicViewWordpressSerializer and the post custom fields through the PostWordpressSerializer.

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

---

<div class="post-metadata">

### Author: ![doserved](https://avatars.discourse-cdn.com/v4/letter/d/e9bcb4/32.png) [@doserved](https://meta.discourse.org/u/doserved)
#### Post date: [25.Июнь.2016 15:25:11 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/53 "2016-06-25T15:25:11Z")

</div>

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:in `calculate\_topic\_average’

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [27.Июнь.2016 13:16:04 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/54 "2016-06-27T13:16:04Z")

</div>

@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](https://github.com/angusmcleod/discourse-ratings/commit/450f528e5b52248a6082863c3a3b146bf927b099)

---

<div class="post-metadata">

### Author: ![doserved](https://avatars.discourse-cdn.com/v4/letter/d/e9bcb4/32.png) [@doserved](https://meta.discourse.org/u/doserved)
#### Post date: [27.Июнь.2016 18:30:59 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/55 "2016-06-27T18:30:59Z")

</div>

Angus,

It works now. Thanks for making the fix!

David

---

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [07.Сентябрь.2016 13:19:01 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/56 "2016-09-07T13:19:01Z")

</div>

Italian translation  
[client.it.yml](https://global.discourse-cdn.com/meta/original/3X/5/1/5168a6801e31922ae39c5267de8734bc8659f82d.yml) (469 Bytes)

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [07.Сентябрь.2016 13:29:24 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/57 "2016-09-07T13:29:24Z")

</div>

Cool, if you make it a PR I’ll add it to the repo.

---

<div class="post-metadata">

### Author: ![11147](https://avatars.discourse-cdn.com/v4/letter/1/76d3ee/32.png) [@11147](https://meta.discourse.org/u/11147)
#### Post date: [23.Сентябрь.2016 13:43:34 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/58 "2016-09-23T13:43:34Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [23.Сентябрь.2016 14:03:45 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/59 "2016-09-23T14:03:45Z")

</div>

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

---

<div class="post-metadata">

### Author: ![11147](https://avatars.discourse-cdn.com/v4/letter/1/76d3ee/32.png) [@11147](https://meta.discourse.org/u/11147)
#### Post date: [23.Сентябрь.2016 15:25:50 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/60 "2016-09-23T15:25:50Z")

</div>

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

I use the develoment environment.

 ![](https://global.discourse-cdn.com/meta/original/3X/e/c/ece74dbd6fab2e4c7bee36c6cdd73c54264c4c9c.png)

[Предыдущая страница](https://meta.discourse.org/t/topic-ratings-plugin/39578.md?page=2)

[Следующая страница](https://meta.discourse.org/t/topic-ratings-plugin/39578.md?page=4)
