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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 82e7be5fe8eb2d91d460654a567fb9303b65e2527e9966a90d559cad5869ffe0
4
- data.tar.gz: d9e03672fe5e458743202d679b427702e7a36e885d947d7016d8d47638a79152
3
+ metadata.gz: 7965607af97695a0f815b52fc983ef80e9aa3e7866428e4feb9205c8abeda5de
4
+ data.tar.gz: 4ce26449036e0de9eb8698d52b3c63614ca488ce0012d9071dd88604efe347c9
5
5
  SHA512:
6
- metadata.gz: 65c2ec592a79a202efd7ca889382ce7fd457945d29b0ba416e81c6e77936e57e5f58c4060f0dfce5bdaddc5d934756819ac9a5b04fb02283827be02df512cf53
7
- data.tar.gz: 6ffd8ca5d908679517758959e63ce1a6c5f2f6f333be0151f8e8ae32b4ee3f35062a812898c1c557d584a9213046e316c6b6f6454a9e6a29bbe2bf40323dbc80
6
+ metadata.gz: ec9a0982c38a1bb5ca7a4561a1075b0473da9f5a7a06d616d5fcf19ee357788ce8786c9aa6455a2a7c4a35ffaaf6e27bcc7248394726883b594c410592f5d5ba
7
+ data.tar.gz: 44d1041a5b7d3d4ea5245a742e8745c435dbbd55b7fb28187b4177cb8092cb05db69eff55be4aea8f8edeccfcf9d1bd8efb3466f798c03df4f71cdfecce43c22
@@ -1,4 +1,4 @@
1
- <div class="card card-body">
1
+ <div class="card-body">
2
2
  <%= metric_form_for metric do |f| %>
3
3
  <div class="header-elements-inline">
4
4
  <div>
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
- true
85
+ ranges.any?
86
86
  end
87
87
 
88
88
  private
@@ -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.excluded_ranges << key.to_s
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.except(*excluded_ranges).sort_by { |_, range| range.priority }.collect { |key, range_thing| [range_thing.label, key] }
106
+ ranges.sort_by { |_, range| range.priority }.collect { |key, range_thing| [range_thing.label, key] }
102
107
  end
103
108
  end
104
109
  end
@@ -1,3 +1,3 @@
1
1
  module Metricky
2
- VERSION = '0.7.3'
2
+ VERSION = '0.7.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metricky
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Brody