merry_go_round 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -47,10 +47,9 @@ module MerryGoRound
47
47
 
48
48
  # Loop through all of the granularities except for the first one
49
49
  MerryGoRound.granularities.each_with_index do |granularity, index|
50
+ # Skip minutes since the Redis aggregator does those
50
51
  next if index == 0
51
52
 
52
- # TODO: Check time interval to see if we have enough data to do this granularity
53
-
54
53
  # Time interval for granularity
55
54
  interval = seconds(granularity)
56
55
 
@@ -67,6 +66,9 @@ module MerryGoRound
67
66
  range = window(granularity, Time.at(timestamp).utc)
68
67
  break unless range.first < now and range.last < now
69
68
 
69
+ # Check time interval to see if we have enough data to do this granularity
70
+ break if Aggregation.where('key = ? AND granularity = ? AND timestamp = ?', result.key, granularity, range.first).first
71
+
70
72
  children = Aggregation.where('key = ? AND granularity = ? AND timestamp >= ? AND timestamp <= ?', result.key, prev_gran, range.first, range.last).order('timestamp ASC')
71
73
  break unless children.length > 0
72
74
 
@@ -1,3 +1,3 @@
1
1
  module MerryGoRound
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -7,6 +7,7 @@ module MerryGoRound
7
7
  Timecop.freeze(Time.at(1360695600).utc) do
8
8
  redis_fixture('hour')
9
9
  MerryGoRound.aggregate!
10
+ MerryGoRound.aggregate!
10
11
  end
11
12
 
12
13
  # 60 minutes * 3 keys
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merry_go_round
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -152,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
152
  version: '0'
153
153
  segments:
154
154
  - 0
155
- hash: 4560439133261810306
155
+ hash: 3985102410336867870
156
156
  requirements: []
157
157
  rubyforge_project:
158
158
  rubygems_version: 1.8.23