summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/query.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/app/models/query.rb b/app/models/query.rb
index 117f6e226..c09932203 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -1458,11 +1458,13 @@ class Query < ActiveRecord::Base
" AND " +
queried_class.send(:sanitize_sql_for_conditions, ["#{JournalDetail.table_name}.old_value IN (?)", value.map(&:to_s)]) +
")"
- if %w[ev !ev].include?(operator)
- subquery <<
+ sql_ev =
+ if %w[ev !ev].include?(operator)
" OR " + queried_class.send(:sanitize_sql_for_conditions, ["#{db_table}.#{db_field} IN (?)", value.map(&:to_s)])
- end
- sql = "#{neg} EXISTS (#{subquery})"
+ else
+ ''
+ end
+ sql = "#{neg} (EXISTS (#{subquery})#{sql_ev})"
else
sql = '1=0'
end