counter 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/counter.gemspec +1 -1
- data/lib/counter/moving_count.rb +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.2
|
data/counter.gemspec
CHANGED
data/lib/counter/moving_count.rb
CHANGED
@@ -100,7 +100,7 @@ class MovingCount < ActiveRecord::Base
|
|
100
100
|
latest_sample = self.maximum(:sample_time)
|
101
101
|
return if latest_sample.nil? # sample is of course valid if no data exists
|
102
102
|
|
103
|
-
distance = (timestamp - latest_sample).abs
|
103
|
+
distance = (timestamp.to_i - latest_sample.to_i).abs
|
104
104
|
if distance < sample_interval
|
105
105
|
raise "Data recorded at #{self.maximum(:sample_time)} making #{timestamp} #{'%0.2f' % (sample_interval - distance)}s too soon on a #{sample_interval} interval."
|
106
106
|
end
|