Question Answer Plugin

(Evgeny) #105

Perhaps this is due to this?

(Kinto D) #106

I’ve tried the plugin with code changes that removed “vote_count” attribute, and somehow it works.

But vote counter become “undefined”

(Kinto D) #107

I do not understand why the Post model has the vote_count attribute, even though Discourse doesn’t has a feature that votes on a post.

(Angus McLeod) #108

@kinto_d Yes, as @Stranik suggestions, it’s because vote_count was just removed from core.

@tgxworld What would you suggest as the best strategy to deal with existing use of vote_count by this plugin?

I would investigate it more closely myself, but I’m currently without a laptop.

(Alan Tan) #109

@angus A custom field would probably be the best option here. Do you store the votes somewhere?

(Angus McLeod) #110

They were being stored as vote post actions, i.e. in the vote_count column.

Would it be possible to delay the deletion of existing vote_count data? Everything else I can work around.

(Kinto D) #111

I’ve changed Discourse version to v2.0.2 but still have the same error.

Already checked inside the container and Post.rb model has “vote_count” attribute.

(Alan Tan) #112

As in you’re using the PostAction model to store the votes on each post? Because if the plugin is, the votes post action would have been nuked upon upgrade. What I’m going to do instead is to ignore the vote_count column for now and remove the migration that drops the post action.

(Angus McLeod) #113



Thanks, I’ll update the plugin to migrate any existing vote_counts to custom_fields tomorrow.

After a grace period we can remove the existing vote_count columns.

(Alan Tan) #114

Hmm the vote count column isn’t the critical one here since you can recalculate it from the post_actions. Unfortunately for @kinto_d, the columns have already been dropped.

(Angus McLeod) #115

There’s probably a ‘history’ record somewhere I can use to reconstitute any lost data for the period the migration was active. I would check now, but I’m sans laptop.

(Alan Tan) #116

Just in case, we removed the migration in

(Angus McLeod) #117

Much appreciated. Will handle the ‘migration’ to custom fields in this plugin asap.

(Ruth Cheesley) #118

Just to say, I had this issue having just rebuilt as part of a domain migration and had Discourse update itself (and plugins, it seems) which was causing a 500 error.

The logs were showing NoMethodError (undefined method vote_count' for NoMethodError (undefined methodvote_count’ for … etc.

Took some time to identify the issue as I thought initially it must be a routing error from the domain migration! That’ll teach me to remember to update plugins first! :flushed:

(Angus McLeod) #119

Ok, an update here. Sorry for the delay, this caught me at an inconvenient time.

I’ve just merged an update that:

  • Updates the plugin to use various custom_fields to store vote data and integrates that into a functionality identical post vote action UX.

  • Migrates existing post vote actions to the new custom_fields.

Example topic:

This should work seamlessly for anyone who did not upgrade Discourse between these commits:

If you did upgrade Discourse between these commits, after upgrading Discourse and this plugin the QA functionality will work fine, but all votes in existing QA topics will be ‘0’.

The best idea I’ve come up with so far to retrieve vote data for those that upgraded between those commits is to search the production logs for instances of PostAction create, filtering by type and reducing by PostAction destroy (filtered by type). If anyone else has a better idea, let me know.

Rebuilding data from server logs is something of a last ditch effort, but nonetheless if you upgraded in specified period and you’re interested in this solution, please let me know.

Uncaught Errors
Topic Ratings Plugin
(Kinto D) #120

After I update the plugin, I can’t delete the question post (including normal post). Does this just happen to me? or does this happen to others too?


Started DELETE "/t/37" for at 2018-07-15 07:26:14 +0000
Processing by TopicsController#destroy as */*
  Parameters: {"context"=>"/t/lounge-tesests/37", "id"=>"37"}
Clearing Active Record cache, this can happen if schema changed while site is running or in a multisite various databases are running different schemas. Consider running rake multisite:migrate.
Completed 500 Internal Server Error in 39ms (ActiveRecord: 14.6ms)
ActiveRecord::StatementInvalid (PG::UndefinedColumn: ERROR:  column "vote_count" of relation "posts" does not exist
LINE 1: ...osts" SET "bookmark_count" = 0, "like_count" = 0, "vote_coun...
: UPDATE "posts" SET "bookmark_count" = 0, "like_count" = 0, "vote_count" = 0 WHERE "posts"."id" = 59)
/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/rack-mini-profiler-1.0.0/lib/patches/db/pg.rb:95:in `exec'
Failed to handle exception in exception app middleware : PG::UndefinedColumn: ERROR:  column "vote_count" of relation "posts" does not exist

(Jay Pfaffman) #121

You might try a rebuild, especially if you upgraded from the web interface.

(Angus McLeod) #122

What version of the plugin and what version of discourse are you running?

(Jose C Gomez) #123

Installed this, pretty nice however it has an issue with the Badge Flairs on the “Sub replies” see below.

v2.1.0.beta2 +422

(Angus McLeod) #124

Thanks, now fixed :sun_with_face: