metric_admin 0.0.23 → 0.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 563e709e3eed279359a2edcb0d5848c723bdd179
4
- data.tar.gz: 56906b5c54eef337958e036b568f8f1fcc9e8a2a
3
+ metadata.gz: 62c0c0b520fbc7ce04d4892a0766b7fb18d773d6
4
+ data.tar.gz: 6d28e54d4811fcf875c73016a1912fabd395eede
5
5
  SHA512:
6
- metadata.gz: d2c9fb4fc5944b789fe5f3d5801acc8d78e3221b973dc459d072b99b4e8a5d10c28069de747fc5391b2d272bb81d48702f0276393fdc7dc91b3bafcb9f6ed0ee
7
- data.tar.gz: 609e6b26e03fca3924d18c9fb80dd953dec5416466d64bd13c8542cd56b3a17acc12a7ff539a44e467e80f4c1562ffe750df95a94d6242bd9b14ea6b3cd1ae24
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 public_sort column.
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(:public_sort, i)
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.public_sort = Metric.maximum(:public_sort, :conditions=>["resource_type_id = ?", @metric_to_clone.resource_type_id ]).to_i + 1
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
- CalculateMetrics.calculate_metrics_for_id(params[:id])
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.public_sort.nil? ? @metric.resource_type.metrics.count : @metric.public_sort, :disabled => true, :class=>"span3"
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, public_sort 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
- %p.label.warning Has not run today.
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
- = number_to_currency(@result.result)
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
- = @result.result
73
+ = '--'
74
74
  - else
75
75
  / %tr
76
76
  / %td{:style=>"border-top:2px solid #444;background:#fff;"} Sum
@@ -1,3 +1,3 @@
1
1
  module MetricAdmin
2
- VERSION = "0.0.23"
2
+ VERSION = "0.0.28"
3
3
  end
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.23
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: 2017-05-02 00:00:00.000000000 Z
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.6.8
90
+ rubygems_version: 2.5.2
91
91
  signing_key:
92
92
  specification_version: 4
93
93
  summary: Gem that builds and edits metrics.