totalizer 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/totalizer/factory.rb +1 -1
- data/lib/totalizer/message.rb +1 -1
- data/lib/totalizer/metric.rb +1 -1
- data/lib/totalizer/version.rb +1 -1
- data/spec/lib/totalizer/factory_spec.rb +1 -1
- data/spec/lib/totalizer/metric_spec.rb +14 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89db1d11fe08b6b477c7fc209ddb24f7537aec4e
|
4
|
+
data.tar.gz: fcd8cb2f3df52526a4c759c4e993792f79296fa2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec66b19d81c43e9fa88adab5f90b475fb4937f93f358048a194fc7bd177b413e303675a7256bf1135305c91dcd944701dc7d5846706eee3c060517e394aef022
|
7
|
+
data.tar.gz: 7bf3ff04481892b39383f66a06f7b06e01b1b8c67fd9041d3b0d289b5d3194402ea34370eee77da8d37941f0f8b1916e87d256615f4c4b9972f88a8b9e767385
|
data/README.md
CHANGED
@@ -185,6 +185,9 @@ You can also run a single rake task every day which will run execute the daily
|
|
185
185
|
task each time and execute the weekly task on a defined week day which by
|
186
186
|
default is Monday.
|
187
187
|
|
188
|
+
This is handy for things like [Heroku Scheduler](https://elements.heroku.com/addons/scheduler)
|
189
|
+
where you can only schedule daily tasks.
|
190
|
+
|
188
191
|
```
|
189
192
|
$ rake totalizer:combined
|
190
193
|
```
|
data/lib/totalizer/factory.rb
CHANGED
@@ -23,7 +23,7 @@ module Totalizer
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def activity
|
26
|
-
activity_metric = Totalizer::Metric.new self.activity_metric.attributes.merge(date: date, duration: duration
|
26
|
+
activity_metric = Totalizer::Metric.new self.activity_metric.attributes.merge(date: date, duration: duration)
|
27
27
|
ActivityMessage.new(activity_metric, duration)
|
28
28
|
end
|
29
29
|
|
data/lib/totalizer/message.rb
CHANGED
@@ -32,7 +32,7 @@ module Totalizer
|
|
32
32
|
class ActivityMessage < MetricMessage
|
33
33
|
def initialize metric, duration
|
34
34
|
super
|
35
|
-
self.description = "
|
35
|
+
self.description = "Did key activity this period (with rate of change)"
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
data/lib/totalizer/metric.rb
CHANGED
data/lib/totalizer/version.rb
CHANGED
@@ -85,6 +85,20 @@ describe Totalizer::Metric do
|
|
85
85
|
expect(metric.rate).to eq 0
|
86
86
|
end
|
87
87
|
end
|
88
|
+
|
89
|
+
describe 'with multiple records' do
|
90
|
+
let(:metric) { Totalizer::Metric.new(model: Post, map: 'user_id') }
|
91
|
+
before do
|
92
|
+
FactoryGirl.create :post, user_id: user_1.id, created_at: 1.days.ago
|
93
|
+
FactoryGirl.create :post, user_id: user_1.id, created_at: 2.days.ago
|
94
|
+
FactoryGirl.create :post, user_id: user_2.id, created_at: 2.days.ago
|
95
|
+
FactoryGirl.create :post, user_id: user_3.id, created_at: 3.days.ago
|
96
|
+
end
|
97
|
+
|
98
|
+
it "counts the unique map ids for duration" do
|
99
|
+
expect(metric.value).to eq 3
|
100
|
+
end
|
101
|
+
end
|
88
102
|
end
|
89
103
|
|
90
104
|
describe "Filter" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: totalizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Dijkstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|