Skip to content

Commit 0cf015c

Browse files
committed
process all the criterias(not just first one) and store in the filters
1 parent fa98422 commit 0cf015c

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

lib/query_helper/sql_filter.rb

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ def create_filters
2121
raise InvalidQueryError.new("cannot filter by #{comparate_alias}") unless map
2222

2323
# create the filter
24-
@filters << QueryHelper::Filter.new(
25-
operator_code: criteria.keys.first,
26-
criterion: criteria.values.first,
27-
comparate: map.sql_expression,
28-
aggregate: map.aggregate,
29-
qualify_clause: aggregated_attribute?(comparate: map.sql_expression)
30-
)
24+
criteria.each do |k, v|
25+
@filters << QueryHelper::Filter.new(
26+
operator_code: k,
27+
criterion: v,
28+
comparate: map.sql_expression,
29+
aggregate: map.aggregate,
30+
qualify_clause: aggregated_attribute?(comparate: map.sql_expression)
31+
)
32+
end
3133
end
3234
end
3335

0 commit comments

Comments
 (0)