metricky 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/metricky/_metric.html.erb +1 -1
- data/lib/metricky/base.rb +2 -2
- data/lib/metricky/ranges.rb +8 -3
- data/lib/metricky/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7965607af97695a0f815b52fc983ef80e9aa3e7866428e4feb9205c8abeda5de
|
4
|
+
data.tar.gz: 4ce26449036e0de9eb8698d52b3c63614ca488ce0012d9071dd88604efe347c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec9a0982c38a1bb5ca7a4561a1075b0473da9f5a7a06d616d5fcf19ee357788ce8786c9aa6455a2a7c4a35ffaaf6e27bcc7248394726883b594c410592f5d5ba
|
7
|
+
data.tar.gz: 44d1041a5b7d3d4ea5245a742e8745c435dbbd55b7fb28187b4177cb8092cb05db69eff55be4aea8f8edeccfcf9d1bd8efb3466f798c03df4f71cdfecce43c22
|
data/lib/metricky/base.rb
CHANGED
@@ -28,7 +28,7 @@ module Metricky
|
|
28
28
|
def noun
|
29
29
|
{
|
30
30
|
count: "total number of",
|
31
|
-
average: "average #{columns}",
|
31
|
+
average: "average #{columns} of",
|
32
32
|
sum: "total",
|
33
33
|
min: "minimum",
|
34
34
|
max: "maximum"
|
@@ -82,7 +82,7 @@ module Metricky
|
|
82
82
|
|
83
83
|
# If you have a static metric that doesn't need to be queried (e.g. average users age of all users), disable the form
|
84
84
|
def form?
|
85
|
-
|
85
|
+
ranges.any?
|
86
86
|
end
|
87
87
|
|
88
88
|
private
|
data/lib/metricky/ranges.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
module Metricky
|
2
2
|
class Base
|
3
3
|
class_attribute :ranges, default: {}
|
4
|
-
class_attribute :excluded_ranges, default: []
|
5
4
|
class_attribute :default_range_key, default: 'all'
|
6
5
|
|
7
6
|
def self.default_range(val = nil)
|
@@ -43,7 +42,13 @@ module Metricky
|
|
43
42
|
end
|
44
43
|
|
45
44
|
def self.remove_range(key)
|
46
|
-
self.
|
45
|
+
self.ranges.delete(key.to_s)
|
46
|
+
end
|
47
|
+
|
48
|
+
# Remove all ranges
|
49
|
+
def self.reset_ranges!
|
50
|
+
self.ranges = {}
|
51
|
+
self.default_range_key = nil
|
47
52
|
end
|
48
53
|
|
49
54
|
register_range 'all', label: 'All' do
|
@@ -98,7 +103,7 @@ module Metricky
|
|
98
103
|
|
99
104
|
# Used in the HTML form for the metric as the select options
|
100
105
|
def range_collection
|
101
|
-
ranges.
|
106
|
+
ranges.sort_by { |_, range| range.priority }.collect { |key, range_thing| [range_thing.label, key] }
|
102
107
|
end
|
103
108
|
end
|
104
109
|
end
|
data/lib/metricky/version.rb
CHANGED