almicube 0.0.5 → 0.0.6

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: 55a123750b7adb55f8eb6800860c14ac89327d12
4
- data.tar.gz: eda4674e0bb42a6849da342887ccba392a458e23
3
+ metadata.gz: 9fa0b027e6a3cbdfc138f59cc9a9b9a6704227bd
4
+ data.tar.gz: ffb6baa33b5d9940c5fe10c1dd3571d1d44427c1
5
5
  SHA512:
6
- metadata.gz: 7c5a877e0cf9ab583175ea85741aa5f285dd17487c897e9a5603b7bfaea54f76605b73c13764e81ce1ddb73ed11721e6d9642400aa9a023cb36de84ec6c3739b
7
- data.tar.gz: be52c99e63936850c70c80f4387e0c332159d5a68f7980bf0b41ff6b0f7893d424739747dd4f08fd53a766c36fe8146bb315dc8bdc8b903b17813d6845958c44
6
+ metadata.gz: e23331dfcd4ef85a623a8bb406172cefa9f4fb411931e11532d29becf51f610f9006db9ac6b79b76111da3a627afa2615685225bb70feae891365e041a8d1ea3
7
+ data.tar.gz: abbdecc865510ee154bfec2350167b1b5a8252d0348a89f7455eb8fb35a389e40487ff17b8f5f8713b59e315e59875379a595bed359b5f22c6470de4fbeb1ece
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- almicube (0.0.4)
4
+ almicube (0.0.5)
5
5
  activemodel (~> 4.0)
6
6
  activesupport (~> 4.0)
7
7
  redis (~> 3.0)
@@ -12,7 +12,7 @@ module Almicube
12
12
  def aggregate(ranking=nil)
13
13
  self.ranking = ranking unless active? || ranking.nil?
14
14
 
15
- self.ranking.selector.before_aggregate if self.ranking.selector.respond_to? :before_aggregate
15
+ self.ranking.selector.before_aggregate unless self.ranking.selector.nil?
16
16
 
17
17
  if self.ranking.data?
18
18
  data_aggregate self.ranking.key
@@ -4,11 +4,11 @@ module Almicube
4
4
  protected
5
5
 
6
6
  def sub_aggregate(key)
7
- keys = ranking.bundled_keys.select { |k| self.class.connection.zcard(k) > 0 }
7
+ keys = ranking.bundled_keys.select { |k| self.class.connection.exists(k) }
8
+ raise "enabled keys are empty" if keys.length == 0
9
+
8
10
  keys << ranking.selector.interstore if ranking.selector.interstore
9
- if keys.length > 0
10
- self.class.connection.zinterstore(key, keys)
11
- end
11
+ self.class.connection.zinterstore(key, keys)
12
12
  end
13
13
  end
14
14
  end
@@ -12,7 +12,7 @@ module Almicube
12
12
 
13
13
  def data(date=nil)
14
14
  date ||= self.date
15
- Almicube::Ranking::DataRanking.new options
15
+ Almicube::Ranking::DataRanking.new options.merge( date: date )
16
16
  end
17
17
 
18
18
  def options
@@ -33,7 +33,6 @@ module Almicube
33
33
  end
34
34
 
35
35
  def page(page=1)
36
- aggregate!
37
36
  page = [1, page.to_i].max
38
37
  revrange = connection.zrevrange(key, (page - 1) * per_page, page * per_page - 1)
39
38
  records = class_name.where("id IN (?)", revrange).all
@@ -1,3 +1,3 @@
1
1
  module Almicube
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: almicube
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - niaeashes