Topic Ratings Plugin

We can add AggregateRating by default. In the allowed schema type list it have CreativeWork. In Discourse we are using DiscussionForumPosting as default schema type. It is a part of CreativeWork (CreativeWork > Article > SocialMediaPosting > DiscussionForumPosting). So it is 100% appropriate to use AggregateRating in topic ratings :+1:.

I manually tested this functionality in Google’s testing tool.

2 Likes

I cant edit post below a rating topic anymore.

Thanks for the report. Bug fixed.

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

As per @vinothkannans’s advice, I’ve added aggregateRating as part of CreativeWork.

https://github.com/angusmcleod/discourse-ratings/commit/85f82fc2e8843fc8a95847bc82be34eec2b38fc5

@vinothkannans You probably are already aware that Google’s structured data testing tool is complaining about the DiscussionForumPosting microdata for core Discourse topic views not having images. I’m not sure if that omission means the DiscussionForumPosting microdata blocks will be ignored?

Screenshot at Oct 05 08-25-58

4 Likes

I think it needs some changes in both on your code and Discourse core. I will create a PR once it changed in core. For now okay :+1:

4 Likes

Today I enabled this plugin for the first time on a pretty fresh discourse install and I don’t see the star-rating buttons in a reply box (composer) and I get the following error:
https://github.com/angusmcleod/discourse-ratings/issues/10

Update: after rebuilding the discourse app, I can no longer reproduce the TypeError... but I still don’t see the star-ratings buttons.

1 Like

Hey :). The addObject exception is actually unrelated to this plugin. It’s a Discourse exception. I’ve been meaning to report it.

As to the ratings buttons not appearing, I can’t repro it unfortunately. Can you send me some screenshots with the console open?

I tested it locally and on my sandbox here: https://discourse.angusmcleod.com.au/c/ratings

Composer:

Topic:

Topic List:

5 Likes

Thanks! and sorry for undeserved attribution of a bug. :slight_smile:
On screenshots you can see no errors in the Console and no stars-buttons in the Composer or the average-rating div.

Update:

  1. The plugin works well if the post is created in the rating-enabled category initially. However it doesn’t work for the posts in such directory which have been created/edited before error-less installation of this plugin (i.e. I had some Discourse-related error on the server when initially installed this plugin, but after rebuild there was no error).

  2. Unfortunately the plugin doesn’t appear to be working for the posts initially created in a non-rating category, when those posts have been moved to a rating-enabled category, which is sad :’(

1 Like

Thanks for figuring that out. It should work for such ‘pre-existing’ topics now.

https://github.com/angusmcleod/discourse-ratings/commit/2dd9fb80284e9b339f240008a6e8526dd3cb6aac

3 Likes

Thank you that was fast! Indeed, now I can rate the pre-existing topics. However I can also place multiple ratings with the same user, which kind of allows for rating-abuse:

1 Like

Hi , nice plugin

It is possible to create a ranking of this ratings ?

For example i wanna to show the most importand topic from all category or selected in admin menu
For example i want to show on the sidebar Top 10 best rating topic from category X and category Y
It is possiible ?
It would be perfect if the top post will depend on Number of stars + number of votes (quality ratio)

Given enough time, everything breaks, aka entropy … fixed as well :slight_smile:

https://github.com/angusmcleod/discourse-ratings/commit/5d08b456a97e884fc41028323a98007fc0b07a7c

1 Like

Hey

Yes, it’s possible. In a separate plugin you could add a new topic list that sorts topics based on the average_rating topic custom field.

Here’s an example of how to create a new topic list that is sorted by a custom field:

Well, you’ll need a sidebar first. Then a widget that has a topic list in it. Here’s some I prepared earlier:

https://github.com/angusmcleod/discourse-layouts
https://github.com/angusmcleod/layouts-topic-list

So all you need to do is change the topic list in the layouts-topic-list widget to the topic list you created in your new plugin.

  1. Follow the beginners guide to creating a plugin

  2. Add the layouts plugin with the topic list widget

  3. Copy / paste the new topic list code I’ve linked above

  4. Change a few variable names and urls in the topic list widget and the topic list code.

1 Like

For some reason, ratings checkbox is now shown in some composers, and users don’t understand why?

I never configured it or turned on anything like that.

I think I caught it: it is shown when EDITING messages. Even if it’s turned off.

2 Likes

Thanks for the report :+1: Fixed.

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

3 Likes

Hey, Santa Angus! Got some room in your busy schedule? :slight_smile:

https://github.com/angusmcleod/discourse-ratings/issues/11

Added :santa: Setting is rating_show_count; default is false.

https://github.com/angusmcleod/discourse-ratings/commit/0822e094a5fa25d875c615fcc07a1bbd02676d06

See further: https://discourse.angusmcleod.com.au/t/the-400-blows-truffaut/151

3 Likes

Dear Santa, thank you very much! I always believed you were real :blush:

1 Like

Thanks for Your time. Ok i will learn how to do it all becouse im not a programmer… Need some time. Pls tell me - should i learn a ruby laungage or not really ? Should i know somethink more ? How to learn it as fast as it possible (not for be a pro - just for myself needs)

@dalerka @hnaseri As discussed, I’ve updated the average / count style. It now looks like this:

54 PM

Both the Amazon style and the use of an emoji has issues. I think it’s best we keep it simple.

https://github.com/angusmcleod/discourse-ratings/commit/0b7b8fb908cb2073d3a95b3f3f17b9028092bfd2

Thanks for your suggestions :+1:

2 Likes