A platform for community discussion. Free, open, simple.
DEV: Fix const redefine warning in topic voting (#42290)
Martin Brennand798c84585a9
diff --git a/plugins/discourse-topic-voting/lib/discourse_topic_voting/topic_query_extension.rb b/plugins/discourse-topic-voting/lib/discourse_topic_voting/topic_query_extension.rbindex b62fc055078..4c47e5b513a 100644--- a/plugins/discourse-topic-voting/lib/discourse_topic_voting/topic_query_extension.rb+++ b/plugins/discourse-topic-voting/lib/discourse_topic_voting/topic_query_extension.rb@@ -1,15 +1,15 @@# frozen_string_literal: truemodule DiscourseTopicVoting- TRENDING_SCORE_SQL = <<~SQL.squish- COALESCE((- SELECT SUM(1.0 / (EXTRACT(EPOCH FROM (NOW() - tv.created_at)) / 3600.0 + 2.0))- FROM topic_voting_votes tv- WHERE tv.topic_id = topics.id- ), 0)- SQL-module TopicQueryExtension+ TRENDING_SCORE_SQL = <<~SQL.squish+ COALESCE((+ SELECT SUM(1.0 / (EXTRACT(EPOCH FROM (NOW() - tv.created_at)) / 3600.0 + 2.0))+ FROM topic_voting_votes tv+ WHERE tv.topic_id = topics.id+ ), 0)+ SQL+def list_voted_by(user)create_list(:user_topics) do |topics|topics.joins(@@ -34,7 +34,7 @@ module DiscourseTopicVotingtopics.joins("LEFT JOIN topic_voting_topic_vote_count dvtvc ON dvtvc.topic_id = topics.id",).order(- "#{DiscourseTopicVoting::TRENDING_SCORE_SQL} DESC, COALESCE(dvtvc.votes_count, 0) DESC, topics.bumped_at DESC",+ "#{TRENDING_SCORE_SQL} DESC, COALESCE(dvtvc.votes_count, 0) DESC, topics.bumped_at DESC",)endelse