Merge pull request #45 from davidtaylorhq/filter_parameters

Change parameters from true/false to solved/unsolved.
This commit is contained in:
Sam 2017-02-28 10:40:06 -05:00 committed by GitHub
commit fcd5a06e69
1 changed files with 2 additions and 2 deletions

View File

@ -341,14 +341,14 @@ SQL
require_dependency 'topic_query' require_dependency 'topic_query'
TopicQuery.add_custom_filter(:solved) do |results, topic_query| TopicQuery.add_custom_filter(:solved) do |results, topic_query|
if topic_query.options[:solved] == 'true' if topic_query.options[:solved] == 'yes'
results = results.where("topics.id IN ( results = results.where("topics.id IN (
SELECT tc.topic_id SELECT tc.topic_id
FROM topic_custom_fields tc FROM topic_custom_fields tc
WHERE tc.name = 'accepted_answer_post_id' AND WHERE tc.name = 'accepted_answer_post_id' AND
tc.value IS NOT NULL tc.value IS NOT NULL
)") )")
elsif topic_query.options[:solved] == 'false' elsif topic_query.options[:solved] == 'no'
results = results.where("topics.id NOT IN ( results = results.where("topics.id NOT IN (
SELECT tc.topic_id SELECT tc.topic_id
FROM topic_custom_fields tc FROM topic_custom_fields tc