From 0da5124f77363009c0f45e185b8b96f4d400d696 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Mon, 27 Feb 2017 22:49:53 +0000 Subject: [PATCH 1/2] Change parameters from true/false to solved/unsolved. https://discuss.emberjs.com/t/boolean-query-params/4301 --- plugin.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin.rb b/plugin.rb index ad75663..197a78f 100644 --- a/plugin.rb +++ b/plugin.rb @@ -341,14 +341,14 @@ SQL require_dependency 'topic_query' TopicQuery.add_custom_filter(:solved) do |results, topic_query| - if topic_query.options[:solved] == 'true' + if topic_query.options[:solved] == 'solved' results = results.where("topics.id IN ( SELECT tc.topic_id FROM topic_custom_fields tc WHERE tc.name = 'accepted_answer_post_id' AND tc.value IS NOT NULL )") - elsif topic_query.options[:solved] == 'false' + elsif topic_query.options[:solved] == 'unsolved' results = results.where("topics.id NOT IN ( SELECT tc.topic_id FROM topic_custom_fields tc From 889aeb5b6ea1633bec0564636324e58d3559d15f Mon Sep 17 00:00:00 2001 From: David Taylor Date: Tue, 28 Feb 2017 15:22:07 +0000 Subject: [PATCH 2/2] Changed strings to yes/no --- plugin.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin.rb b/plugin.rb index 197a78f..302ee3a 100644 --- a/plugin.rb +++ b/plugin.rb @@ -341,14 +341,14 @@ SQL require_dependency 'topic_query' TopicQuery.add_custom_filter(:solved) do |results, topic_query| - if topic_query.options[:solved] == 'solved' + if topic_query.options[:solved] == 'yes' results = results.where("topics.id IN ( SELECT tc.topic_id FROM topic_custom_fields tc WHERE tc.name = 'accepted_answer_post_id' AND tc.value IS NOT NULL )") - elsif topic_query.options[:solved] == 'unsolved' + elsif topic_query.options[:solved] == 'no' results = results.where("topics.id NOT IN ( SELECT tc.topic_id FROM topic_custom_fields tc