Merge pull request #68 from FoboCasteR/fix-issue-60
fix filter for mongoid (Fix #60)
This commit is contained in:
commit
4a7532f69b
|
@ -37,7 +37,8 @@ module Impressionist
|
||||||
def impressionist_count(options={})
|
def impressionist_count(options={})
|
||||||
options.reverse_merge!(:filter=>:request_hash, :start_date=>nil, :end_date=>Time.now)
|
options.reverse_merge!(:filter=>:request_hash, :start_date=>nil, :end_date=>Time.now)
|
||||||
imps = options[:start_date].blank? ? impressions : impressions.between(created_at: options[:start_date]..options[:end_date])
|
imps = options[:start_date].blank? ? impressions : impressions.between(created_at: options[:start_date]..options[:end_date])
|
||||||
options[:filter] == :all ? imps.count : imps.where(options[:filter].ne => nil).count
|
filter = options[:filter]
|
||||||
|
filter == :all ? imps.count : imps.where(filter.ne => nil).distinct(filter).count
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_impressionist_counter_cache
|
def update_impressionist_counter_cache
|
||||||
|
|
Loading…
Reference in New Issue