prosperity 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/prosperity/metrics_controller.rb +2 -1
- data/lib/prosperity/period.rb +10 -2
- data/lib/prosperity/version.rb +1 -1
- data/spec/controllers/prosperity/metrics_controller_spec.rb +8 -0
- data/spec/dummy/app/prosperity/ruby_users_metric.rb +5 -0
- data/spec/dummy/log/development.log +4759 -0
- data/spec/dummy/log/test.log +6803 -0
- data/spec/dummy/tmp/cache/assets/development/sass/34a577735054231563e7022ea73e1468db9203ba/application.css.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/07e8fb2db7d85e29590a6b05160ca825 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/0a40fa5e0d6c0de40a8a698dcd697305 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1533bcf4a8f5a745dfda80cebd88d217 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1643e7f9f85637df140a850af6674f10 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/197492ed379339e17a0f5d01d3b01b8c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1c55cf24465f311353197ce336df0178 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/210050da208fb75a75b701bfa4e8470f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/27a59e08207d3ae723f2b2b3d22264c3 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/3e21790900d62ae3954585f08a1cb28a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/3f76425644a701b85db3d385f077052d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/441f922b26aae90d40e319b6ed0a3bc8 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/448c1e44da04c20f27eaa31ad8c4391e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/47cc93f04a83c418e8f544aeab9208d8 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/47df4fdca8a2ff6a43c18d7aa1ffd9c5 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/647038c58f26163a9217646e1e5f09ae +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/6882b260ae69f1594eff540d803e5ac3 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/69f4b83d363269ee4122bbbaaa1325d1 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/72c0d4a0eeedae5e79ae49abb24f6d32 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/828a046f0e7dc2dad0eecfe49d31e14d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/91ae0bd43f98b4f1f111e0bdc178302c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/990cf740a7968767a327f6186313badb +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/9a690664139b0393787d6454b4697183 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a2b14d5c46db32da9183354fb3fcd0bf +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a6d6196cfd275dea0718553a95f997a5 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/b8a9886650603baf49c9a1e13f3fd7bf +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/bc83340720a76d8208112f6aecbff08e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/df796f7ea525be06a82ebc3a4f97ffec +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/e02b5049cf477b43a72b4a00e2fceb46 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/e2a9bdd87a2d19256837fce6544a122c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ee3031bd54230ddf2addb5fa5718c86b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f4648036e284d9aa3468f4f7b9bbb967 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f961f7434a28c0fe24bf4ffe6cba75fb +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/fb8d3825617fcc11dfa614a51effee0e +0 -0
- data/spec/lib/prosperity/periods_spec.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 008b05b3d6cff9ffbe1fa9e2f26bdea7ae259762
|
4
|
+
data.tar.gz: 54729633e2aa2675fca30a0dc3e793df28c62691
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 668d601aa27d60b1d8f61c3d12de2c0bc1e8ce7b70290504ba73832e130f6b7ccdd7caa25776aa38088504d7ab6ff3cd12c2934d8d0c16cfddb142d2265a246f
|
7
|
+
data.tar.gz: 9397bf4bce9520b944c6575565d98efb066932560784c4aa7f72c596b455ef3d5c7d042424bd04f116a3ee4a55e9d46dc6ff5a7b989e3524a91ab06820202fd0
|
@@ -45,7 +45,8 @@ module Prosperity
|
|
45
45
|
data: ext.to_a,
|
46
46
|
key: ext.key,
|
47
47
|
label: ext.label,
|
48
|
-
start_time: start_time.iso8601,
|
48
|
+
start_time: p.actual_start_time(start_time).iso8601,
|
49
|
+
end_time: p.actual_end_time(end_time).iso8601,
|
49
50
|
period_milliseconds: p.duration * 1000
|
50
51
|
}
|
51
52
|
render json: json
|
data/lib/prosperity/period.rb
CHANGED
@@ -1,12 +1,20 @@
|
|
1
1
|
module Prosperity
|
2
2
|
class Period < Struct.new(:db_strf_str, :ruby_strf_str, :duration, :floor_date, :ceil_date)
|
3
3
|
def each_period(start_time, end_time)
|
4
|
-
start_time =
|
5
|
-
end_time =
|
4
|
+
start_time = actual_start_time(start_time)
|
5
|
+
end_time = actual_end_time(end_time) + 1
|
6
6
|
while start_time <= end_time
|
7
7
|
yield start_time
|
8
8
|
start_time += duration
|
9
9
|
end
|
10
10
|
end
|
11
|
+
|
12
|
+
def actual_start_time(start_time)
|
13
|
+
floor_date.call(start_time)
|
14
|
+
end
|
15
|
+
|
16
|
+
def actual_end_time(end_time)
|
17
|
+
ceil_date.call(end_time) + 1
|
18
|
+
end
|
11
19
|
end
|
12
20
|
end
|
data/lib/prosperity/version.rb
CHANGED
@@ -46,6 +46,14 @@ module Prosperity
|
|
46
46
|
json['data'].should == [1,2,3]
|
47
47
|
end
|
48
48
|
|
49
|
+
it "returns the actual start and end time" do
|
50
|
+
Extractors::Interval.any_instance.stub(to_a: [1,2,3])
|
51
|
+
get :data, id: metric.id, format: 'json'
|
52
|
+
response.should be_success
|
53
|
+
json['start_time'].should be_present
|
54
|
+
json['end_time'].should be_present
|
55
|
+
end
|
56
|
+
|
49
57
|
it "lets you specify any extractor key" do
|
50
58
|
Extractors::Total.any_instance.stub(to_a: [1,2,3])
|
51
59
|
|