diff --git a/app/models/query.rb b/app/models/query.rb index a557ebf14..ddf4d87d9 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -38,7 +38,7 @@ class QueryColumn def sortable? !@sortable.nil? end - + def sortable @sortable.is_a?(Proc) ? @sortable.call : @sortable end @@ -711,10 +711,10 @@ class Query < ActiveRecord::Base "(#{nl} #{Issue.table_name}.assigned_to_id #{sw} IN (SELECT DISTINCT #{Member.table_name}.user_id FROM #{Member.table_name}" + " WHERE #{Member.table_name}.project_id = #{Issue.table_name}.project_id))" when "=", "!" - role_cond = value.any? ? + role_cond = value.any? ? "#{MemberRole.table_name}.role_id IN (" + value.collect{|val| "'#{connection.quote_string(val)}'"}.join(",") + ")" : "1=0" - + sw = operator == "!" ? 'NOT' : '' nl = operator == "!" ? "#{Issue.table_name}.assigned_to_id IS NULL OR" : '' "(#{nl} #{Issue.table_name}.assigned_to_id #{sw} IN (SELECT DISTINCT #{Member.table_name}.user_id FROM #{Member.table_name}, #{MemberRole.table_name}" +