popularable 1.3.0 → 1.4.0

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: e34ddd97dbe7f7ab647b5a69dd87c17716257d91
4
- data.tar.gz: 199f8adc7b1e0b6c064f57e59ad94c4d7e22e590
3
+ metadata.gz: 5dea7513ce34d50d024fa8a6bb339d282715b333
4
+ data.tar.gz: d68e83c7e24abb30727c69f06799371c69c63c0d
5
5
  SHA512:
6
- metadata.gz: d6773f828848ce71c568983373c285697ae2f131982140b709f5ad7bb69269d10b2af2b9e546eee5d76735953b9bfc41cf92b0c0c384a17e0b1cf8a6a9a57dc3
7
- data.tar.gz: 9021be4556e8bacc2bf8b53d66fa1457387b5093661507740d76561fe6196e1a677f4d0df69c26212232cd46cddb76b670a94a48d65f8320b003334a54a55a41
6
+ metadata.gz: d3651f556ae0029a82fdffe76805dfbc206f711a84c06cdfd0e48ea83865cd0a50dff0499d7b8c98ba462dc282119ffedce9be05ac5051266786209c5c5ac51e
7
+ data.tar.gz: 8b110c87827bf75e8e7c1be428daa7184212091c88e6a76e4b1104ad7788adad3b709f0465a7439d995a7cbc0cd9897c40d9f10dbbad5eece529f54c87bead46
@@ -23,11 +23,11 @@ module Popularable
23
23
 
24
24
  scope :popular_all_time, -> {
25
25
  # This uses an inner join and ditches the unnecessary where clause for performance.
26
- select( "#{self.table_name}.*, 0 + SUM(popularable_popularity_events.popularity) AS popularity").joins( "INNER JOIN popularable_popularity_events ON (#{self.table_name}.id = popularable_popularity_events.popularable_id AND popularable_popularity_events.popularable_type = '#{self.to_s}')").group( "#{self.table_name}.id" ).order( "popularity DESC" )
26
+ select( "#{self.table_name}.*, 0 + SUM(popularable_popularity_events.popularity) AS popularity").joins( "INNER JOIN popularable_popularity_events ON (#{self.table_name}.id = popularable_popularity_events.popularable_id AND popularable_popularity_events.popularable_type = '#{self.name}')").group( "#{self.table_name}.id" ).order( "popularity DESC" )
27
27
  }
28
28
 
29
29
  scope :popular_since, -> (since){
30
- select( "#{self.table_name}.*, 0 + SUM(popularable_popularity_events.popularity) AS popularity").joins( "LEFT OUTER JOIN popularable_popularity_events ON (#{self.table_name}.id = popularable_popularity_events.popularable_id AND popularable_popularity_events.popularable_type = '#{self.to_s}')").where( "popularable_popularity_events.popularity_event_date >= ?", since.to_date ).group( "#{self.table_name}.id" ).order( "popularity DESC" )
30
+ select( "#{self.table_name}.*, 0 + SUM(popularable_popularity_events.popularity) AS popularity").joins( "LEFT OUTER JOIN popularable_popularity_events ON (#{self.table_name}.id = popularable_popularity_events.popularable_id AND popularable_popularity_events.popularable_type = '#{self.name}')").where( "popularable_popularity_events.popularity_event_date >= ?", since.to_date ).group( "#{self.table_name}.id" ).order( "popularity DESC" )
31
31
  }
32
32
 
33
33
  has_many :popularable_popularity_events, as: :popularable
@@ -1,5 +1,5 @@
1
1
  module Popularable
2
2
  module Rails
3
- VERSION = "1.3.0"
3
+ VERSION = "1.4.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: popularable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff McFadden