Hey everyone!
I have started volunteering for a community recently and I am tasked with updating an existing plugin. This plugin currently changes a topics tag when it reaches a certain word count threshold. I am supposed to convert this to only count words from posts in the topic that are not from the topic’s creator.
Currently, the word count is achieved by this snippet:
replies = topic.posts.where('post_number > 1')
reply_word_count = replies.sum(:word_count)
I’m thinking the strategy for this will be:
non_op_replies = topic.posts.where('post.user.username != topic.user.username')
reply_word_count = non_op_replies.sum(:word_count)
But this doesn’t seem to work. I have been fiddling around with the syntax for a while and can’t seem to get a working plugin out of it. I have been trying to find documentation for developing in Discourse with Ruby and I am coming up short. I would love if someone is able to help me out or point me in the right direction. I’m also new to Ruby so sorry in advance if it’s just a silly error.