Fix: Custom filter distinct select (#3895)
This commit is contained in:
parent
5c6958482f
commit
fba7f40bee
2 changed files with 3 additions and 3 deletions
|
@ -18,7 +18,7 @@ class Contacts::FilterService < FilterService
|
|||
@query_string += contact_query_string(current_filter, query_hash, current_index)
|
||||
end
|
||||
|
||||
base_relation.select('distinct contacts.id').where(@query_string, @filter_values.with_indifferent_access)
|
||||
base_relation.where(@query_string, @filter_values.with_indifferent_access)
|
||||
end
|
||||
|
||||
def contact_query_string(current_filter, query_hash, current_index)
|
||||
|
|
|
@ -55,7 +55,7 @@ describe ::Contacts::FilterService do
|
|||
attribute_key: 'browser_language',
|
||||
filter_operator: 'equal_to',
|
||||
values: ['en'],
|
||||
query_operator: 'AND'
|
||||
query_operator: 'OR'
|
||||
}.with_indifferent_access,
|
||||
{
|
||||
attribute_key: 'name',
|
||||
|
@ -69,7 +69,7 @@ describe ::Contacts::FilterService do
|
|||
it 'filter contacts by additional_attributes' do
|
||||
params[:payload] = payload
|
||||
result = filter_service.new(params, user_1).perform
|
||||
expect(result[:contacts].length).to be 1
|
||||
expect(result[:count]).to be 2
|
||||
end
|
||||
|
||||
it 'filter contact by tags' do
|
||||
|
|
Loading…
Reference in a new issue