# 话题评分插件

**URL:** https://meta.discourse.org/t/topic-ratings-plugin/39578
**Category:** Plugin
**Tags:** pavilion
**Created:** [2016年二月14日 21:06 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578 "2016-02-14T21:06:53Z")
**Posts on this page:** 20
**Page:** 5

<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: [2016年十一月7日 14:09 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/81 "2016-11-07T14:09:45Z")

</div>

Sorry, looks like I overlooked you bug report here. Are you still experiencing this issue?

---

<div class="post-metadata">

### Author: ![ewanly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ewanly/32/62854_2.png) [@ewanly](https://meta.discourse.org/u/ewanly)
#### Post date: [2016年十一月7日 14:18 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/82 "2016-11-07T14:18:41Z")

</div>

🙂 ..

Yes, I’ve just tested now before I answer you, just in case its fixed with my recent rebuild but, problem still the same ☹

---

<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: [2016年十一月7日 14:23 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/83 "2016-11-07T14:23:05Z")

</div>

Right. Just fixed it. Sorry for the delay here.

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

---

<div class="post-metadata">

### Author: ![ewanly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ewanly/32/62854_2.png) [@ewanly](https://meta.discourse.org/u/ewanly)
#### Post date: [2016年十一月7日 15:09 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/84 "2016-11-07T15:09:14Z")

</div>

Thank you! Its working fine now ✨

---

<div class="post-metadata">

### Author: ![ewanly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ewanly/32/62854_2.png) [@ewanly](https://meta.discourse.org/u/ewanly)
#### Post date: [2016年十一月16日 11:09 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/85 "2016-11-16T11:09:19Z")

</div>

Dear @angus, till today everything were working just fine. After I’d installed Retort Plugin (@gdpelican), I’ve started to experience exactly the same bug again 😱

> [@Topic Ratings Plugin](https://meta.discourse.org/t/topic-ratings-plugin/39578/77):
>
> Sorry its me again. When I’m creating a regular topic (in a category settings unchecked for rating), if I select any tag for that topic, when clicking to create that topic I’m getting this error : Notes: There is no error logs I have only one tag for rating as default and named “rating” (and I’m not using it in this topic creation) This is happening with any chosen non-rating tag When I’m getting this error, there is no rating check box or the stars showed. (as should be) Even if I…

(Again no error log to provide, I’m running the last versions of everything)

Please could you check on it. 🍀

---

<div class="post-metadata">

### Author: ![dgadiraju](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dgadiraju/32/64630_2.png) [@dgadiraju](https://meta.discourse.org/u/dgadiraju)
#### Post date: [2016年十二月29日 14:45 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/86 "2016-12-29T14:45:52Z")

</div>

I just installed as per the instructions and I am getting this error.

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

---

<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: [2017年一月8日 20:23 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/87 "2017-01-08T20:23:36Z")

</div>

This plugin was broken by various discourse/ember updates. Just updated it.

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

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [2017年三月2日 11:54 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/88 "2017-03-02T11:54:30Z")

</div>

Grat plugin, thanks! I’m not sure why I did not see the option “Use topics in this category to rate things” at first, but when I just upgraded another plugin, it magically appeared…

Anyway, I have a feature request. Currently, when a user posts a topic in a category with rating activated and unticks “Add rating”, ratings are disabled for all subsequent posts in that topic. I don’t like that because I want to make sure that users are encouraged rate any post in the Marketplace category (the idea is that if you advertise a product or service in our forum, you have to accept to have it rated).

I see at least two ways of solving this:

1. Add an option “Enforce ratings in this category” to the category settings which prevents topic creators from disabling “add rating”. If they don’t want to give a rating, they just leave it at “0 stars”
2. Change the overall setup so that the OP does not get to decide whether replies to that topic can add a rating or not.

---

<div class="post-metadata">

### Author: ![hnaseri](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hnaseri/32/120660_2.png) [@hnaseri](https://meta.discourse.org/u/hnaseri)
#### Post date: [2017年六月6日 12:26 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/89 "2017-06-06T12:26:05Z")

</div>

In recent updates, when I want to send a PM, there is a rating box like normal posts there, which I think it shouldn’t be.

---

<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: [2017年六月6日 12:46 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/90 "2017-06-06T12:46:07Z")

</div>

Thanks for reporting this. I recently made some changes to make this plugin interoperable with another plugin.

It should work as normal again.

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

---

<div class="post-metadata">

### Author: ![hnaseri](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hnaseri/32/120660_2.png) [@hnaseri](https://meta.discourse.org/u/hnaseri)
#### Post date: [2017年六月6日 12:49 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/91 "2017-06-06T12:49:39Z")

</div>

Thank you very much. Is it possible to make average rating a float number? like 4.7?

---

<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: [2017年六月6日 13:15 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/92 "2017-06-06T13:15:00Z")

</div>

Yup. In fact the averages are already stored in the db rounded to 1 decimal place.

So this small change in the serializer should do the trick.

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

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [2017年六月27日 13:39 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/93 "2017-06-27T13:39:25Z")

</div>

Are there any known issues with this plugin? I have had it installed for a while but never used it. Now when the first topic came up in a ratings-enabled category, it shows that rating is enabled under the topic title but when I reply, there is no way to actually submit a rating…

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [2017年六月27日 14:15 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/94 "2017-06-27T14:15:33Z")

</div>

You can’t rate your own posts. Could that be it?

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [2017年六月27日 14:22 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/95 "2017-06-27T14:22:20Z")

</div>

Good idea, but it’s not my own post. However, the topic owner created the post in a different category and I moved it. Maybe that has something to do with it?

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [2017年六月27日 14:25 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/96 "2017-06-27T14:25:36Z")

</div>

> [@tophee](#):
>
> Maybe that has something to do with it?

That is almost definitely it. As the same thing (used to?) throw off the topic-timers for auto close when moving from one category to another.

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [2017年六月27日 14:32 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/97 "2017-06-27T14:32:04Z")

</div>

> [@cpradio](#):
>
> That is almost definitely it.

Let’s hope so. But I thought this has been fixed since a while:

> [@Transfer poll votes when moving a topic into an existing one](https://meta.discourse.org/t/transfer-poll-votes-when-moving-a-topic-into-an-existing-one/63678/8):
>
> Thanks for reporting @tobiaseigen thumbsup Fixed in

I’ve definitely upgraded several times since that commit.

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [2017年六月27日 15:34 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/100 "2017-06-27T15:34:51Z")

</div>

That is not the same thing. This is Topic Ratings, not Polls. Topic Ratings might not be storing its data the same way Polls did.

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [2017年六月27日 15:38 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/101 "2017-06-27T15:38:45Z")

</div>

I should have quoted the commit, which was not specific to any particular plugin

[https://github.com/discourse/discourse/commit/5794ff53a197b35e67a8ecfbedc6d7d626e872be](https://github.com/discourse/discourse/commit/5794ff53a197b35e67a8ecfbedc6d7d626e872be)

But you are still right that we have a different issue here because we are not moving custom fields _out_ of a topic but we are moving a post _into_ a new topic and that’s probably where the necessary custom fields are not being created/populated. At least that is my guess about what is happening here.

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [2017年六月27日 15:42 UTC](https://meta.discourse.org/t/topic-ratings-plugin/39578/102 "2017-06-27T15:42:29Z")

</div>

Wait… you are still confusing me.

Are you talking about Polls or Topic Ratings? The PR you linked to was to specifically solve an issue with Polls, which stores its data in the custom\_fields associated to a **_post_**.

Topic Ratings, stores ratings on a **_topic_**. I cannot say (without looking at the code), whether it is on the OP of the topic (thus associating it to the **_first post_** in a topic), or if there is another custom\_fields variant that is specific for **_topics_**. If there is one specific to topics, then the PR you reference is irrelevant, as it only deals with posts.

**Edit:**  
And looking at [discourse-ratings/plugin.rb at main · paviliondev/discourse-ratings · GitHub](https://github.com/angusmcleod/discourse-ratings/blob/master/plugin.rb), I see custom\_fields referenced on posts, topics, and categories.

I have a feeling this deals with the topic custom fields. Which the referenced PR does not handle (or possibly the category)

[上一頁](https://meta.discourse.org/t/topic-ratings-plugin/39578.md?page=4)

[下一頁](https://meta.discourse.org/t/topic-ratings-plugin/39578.md?page=6)
