metric_admin 0.0.23 → 0.0.28
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/controllers/admin/metrics_controller.rb +8 -3
- data/app/helpers/metrics_helper.rb +1 -1
- data/app/views/admin/metrics/edit.haml +1 -1
- data/app/views/admin/metrics/index.haml +3 -3
- data/app/views/metrics/metric_detail.html.haml +2 -2
- data/lib/metric_admin/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62c0c0b520fbc7ce04d4892a0766b7fb18d773d6
|
4
|
+
data.tar.gz: 6d28e54d4811fcf875c73016a1912fabd395eede
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59d137dea8b280b9586bf3ac9e385e5775c54317119d7f66c9ad4a02f7cbd024a98c964a9bb641387f34e751b8c7f2da6f4e39faac6433ba4081b63ac7a00421
|
7
|
+
data.tar.gz: 80b94995ed3759bf55a05cec8ee29716cf6395de0b2c86b2a42c454240e02f16e0f3b8d8b4d7ecc34cb7ff44b142d98994d0db8a5beb2d4ec2f658be1363d816
|
data/README.md
CHANGED
@@ -133,7 +133,7 @@ Link the metric_admin.js and the metric_admin.css in the admin view in ```layout
|
|
133
133
|
|
134
134
|
Also ensure that you have linked in the admin layout the lastest jquery.ui.min.js file.
|
135
135
|
|
136
|
-
Ensure that the metric table has a
|
136
|
+
Ensure that the metric table has a sort column.
|
137
137
|
|
138
138
|
In the dashboard application modify ```app/models/metric.rb```
|
139
139
|
|
@@ -54,7 +54,7 @@ module MetricAdmin
|
|
54
54
|
def sort
|
55
55
|
params[:metric].each_with_index do |metric_id, i|
|
56
56
|
@metric = Metric.find(metric_id)
|
57
|
-
@metric.update_attribute(:
|
57
|
+
@metric.update_attribute(:sort, i)
|
58
58
|
end
|
59
59
|
render :text => "sorted"
|
60
60
|
end
|
@@ -63,7 +63,7 @@ module MetricAdmin
|
|
63
63
|
@metric_to_clone = Metric.find(params[:id])
|
64
64
|
@metric = @metric_to_clone.clone
|
65
65
|
@metric.title = "Copy of #{@metric.title}"
|
66
|
-
@metric.
|
66
|
+
@metric.sort = Metric.maximum(:sort, :conditions=>["resource_type_id = ?", @metric_to_clone.resource_type_id ]).to_i + 1
|
67
67
|
if @metric.save
|
68
68
|
flash[:notice] = "#{@metric.title} has been cloned"
|
69
69
|
redirect_to edit_admin_metric_url(@metric)
|
@@ -74,7 +74,12 @@ module MetricAdmin
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def calculate
|
77
|
-
|
77
|
+
threads = []
|
78
|
+
flash[:notice] = "Started calculating..."
|
79
|
+
threads << Thread.new do
|
80
|
+
CalculateMetrics.calculate_metrics_for_id(params[:id])
|
81
|
+
end
|
82
|
+
threads.each(&:join)
|
78
83
|
flash[:notice] = "Completed calculating"
|
79
84
|
redirect_to admin_metrics_url
|
80
85
|
end
|
@@ -18,7 +18,7 @@ module MetricsHelper
|
|
18
18
|
summary_action_on_index = headers.index(summary_action_on)
|
19
19
|
end
|
20
20
|
|
21
|
-
summary_results = results.map{|x| x[summary_index]}.uniq.sort - [summary_key]
|
21
|
+
summary_results = results.map{|x| x[summary_index]}.uniq.compact.sort - [summary_key]
|
22
22
|
|
23
23
|
case summary.action
|
24
24
|
when 'count'
|
@@ -39,7 +39,7 @@
|
|
39
39
|
.control-group
|
40
40
|
%label.control-label{:for => "title"} Sort order
|
41
41
|
.controls
|
42
|
-
= f.text_field :sort, :value => @metric.
|
42
|
+
= f.text_field :sort, :value => @metric.sort.nil? ? @metric.resource_type.metrics.count : @metric.sort, :disabled => true, :class=>"span3"
|
43
43
|
|
44
44
|
.span6
|
45
45
|
.row
|
@@ -18,7 +18,7 @@
|
|
18
18
|
%h2.page-subtitle.pull-left= c.name
|
19
19
|
= link_to "<i class='icon-plus icon-white'></i> Create a new #{c.name} metric", new_admin_metric_url(:resource_type_id => c), :class=>"btn btn-primary pull-right"
|
20
20
|
|
21
|
-
- metrics = Metric.all(:conditions=>["resource_type_id=?", c.id], :order => 'category ASC,
|
21
|
+
- metrics = Metric.all(:conditions=>["resource_type_id=?", c.id], :order => 'category ASC, sort ASC')
|
22
22
|
|
23
23
|
- if metrics
|
24
24
|
- metrics.group_by{|x| x.category }.each do |category, _metrics|
|
@@ -31,8 +31,8 @@
|
|
31
31
|
%div.list-group-item
|
32
32
|
= link_to metric.title, edit_admin_metric_path(metric.id)
|
33
33
|
|
34
|
-
- if Result.count(:conditions=>["calculated_at = ? and metric_id = ?", Date.today.to_s, metric.id ]) == 0 && metric.status == 'active'
|
35
|
-
|
34
|
+
/ - if Result.count(:conditions=>["calculated_at = ? and metric_id = ?", Date.today.to_s, metric.id ]) == 0 && metric.status == 'active'
|
35
|
+
/ %p.label.warning Has not run today.
|
36
36
|
- if metric.status != 'active'
|
37
37
|
%p.label{:style=>"margin-left:5px;"} Not Active
|
38
38
|
|
@@ -63,14 +63,14 @@
|
|
63
63
|
- headers[1..-1].each_with_index do |col, i|
|
64
64
|
%td{:class=> (i+2 == headers.count) || ((col.downcase["value"]) || (col.downcase["amount"]) ) ? "tr" : "tl", :style=>"border-top:2px solid #444; background:#fff;"}
|
65
65
|
- if (i+2 == headers.count)
|
66
|
-
=
|
66
|
+
= '--'
|
67
67
|
- if @metric.data_type == "average"
|
68
68
|
%tr
|
69
69
|
%td{:style=>"border-top:2px solid #444;background:#fff;"} Average
|
70
70
|
- headers[1..-1].each_with_index do |col, i|
|
71
71
|
%td{:class=> (i+2 == headers.count) || ((col.downcase["value"]) || (col.downcase["amount"]) ) ? "tr" : "tl", :style=>"border-top:2px solid #444; background:#fff;"}
|
72
72
|
- if (i+2 == headers.count)
|
73
|
-
=
|
73
|
+
= '--'
|
74
74
|
- else
|
75
75
|
/ %tr
|
76
76
|
/ %td{:style=>"border-top:2px solid #444;background:#fff;"} Sum
|
data/lib/metric_admin/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metric_admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.28
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Analytics For Lawyers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
87
|
version: '0'
|
88
88
|
requirements: []
|
89
89
|
rubyforge_project:
|
90
|
-
rubygems_version: 2.
|
90
|
+
rubygems_version: 2.5.2
|
91
91
|
signing_key:
|
92
92
|
specification_version: 4
|
93
93
|
summary: Gem that builds and edits metrics.
|