impressionist 1.4.10 → 1.4.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f58e0b9865b2468ed84b3245dd951cb76c0a012
4
- data.tar.gz: 1ded6cf6ead23749946da1b25a032fe31cbfe986
3
+ metadata.gz: 1bc58f25a7575987707c4e3c1db283b667c92def
4
+ data.tar.gz: 1366d3c96dc8d9f450df03b08e9dd4baca0352d3
5
5
  SHA512:
6
- metadata.gz: b7fa04698424ff011b069ea4049bf5834c8c156a3e341e1aa2e77980461f001e3b7ebcc7e37abcaab781ba29047dd52d47dd0ffda7ee3482c2f3e857977a025a
7
- data.tar.gz: e18aabaaa1b198fd3cd2f5bc00b7119cac0c8db130abc00256d39ef9852edd65a0ca793957aa2130609e980bfa4a49276dbe536ba3012096b393da6331531404
6
+ metadata.gz: b443bea4b273f98ec4a62cc06e57ad8db6743c25789087d78058c1a9b22332daadcdcf88b64ff8fd5f74b477814afa8146a07b9219e29febc0dea4248a4e67eb
7
+ data.tar.gz: 6c56d18c5464fcbf7241e5a33a815c254db3194673535524c29eaa2733d0e99d09ed6cc63cde068de75fb8f5ca6cdf41bdbf1955c8e71193eb0e9725e0864b34
@@ -24,15 +24,19 @@ module Impressionist
24
24
 
25
25
  end # end of ClassMethods
26
26
 
27
- # ------------------------------------------
28
- # TODO: CLEAN UP, make it HUMAN readable
29
27
  def impressionist_count(options={})
30
- options.reverse_merge!(:filter=>:request_hash, :start_date=>nil, :end_date=>Time.now)
31
- imps = options[:start_date].blank? ? impressions : impressions.where("created_at>=? and created_at<=?",options[:start_date],options[:end_date])
28
+ # Uses these options as defaults unless overridden in options hash
29
+ options.reverse_merge!(:filter => :request_hash, :start_date => nil, :end_date => Time.now)
30
+
31
+ # If a start_date is provided, finds impressions between then and the end_date. Otherwise returns all impressions
32
+ imps = options[:start_date].blank? ? impressions : impressions.where("created_at >= ? and created_at <= ?", options[:start_date], options[:end_date])
33
+
34
+ # Count all distinct impressions unless the :all filter is provided.
35
+ distinct = options[:filter] != :all
32
36
  if Rails::VERSION::MAJOR == 4
33
- options[:filter] == :all ? imps.count : imps.select(options[:filter]).distinct.count
37
+ distinct ? imps.select(options[:filter]).distinct.count : imps.count
34
38
  else
35
- options[:filter] == :all ? imps.count : imps.count(options[:filter], :distinct => true)
39
+ distinct ? imps.count(options[:filter], :distinct => true) : imps.count
36
40
  end
37
41
  end
38
42
 
@@ -1,3 +1,3 @@
1
1
  module Impressionist
2
- VERSION = "1.4.10"
2
+ VERSION = "1.4.11"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: impressionist
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.10
4
+ version: 1.4.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - johnmcaliley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-30 00:00:00.000000000 Z
11
+ date: 2013-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient