aptible-rails 0.4.5 → 0.4.6

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
  SHA1:
3
- metadata.gz: 4958636cae6b034e1241110f6e1774f51e6b5e80
4
- data.tar.gz: 8596952c947ab63ab3a6a5d3bbe706f1d12a2823
3
+ metadata.gz: 3066c48b9a5b96899937c0c23988dd3b36c13521
4
+ data.tar.gz: 2c8803908cbb25765394f860e45dd5be751e90c1
5
5
  SHA512:
6
- metadata.gz: b4541522805f44c58dbb763cbc1f717bd3058ab9ecfbcb62916b78cd2ce4a3a54af62e237cf7f2fca99f62f6821904330c36faae1e0118254dd773b1be065b65
7
- data.tar.gz: bd0c509d1c06c1debd5d4f0b36437b2934961d6a343bddc6e32a7d3651bbcdb23b19cd6a386f85c1456818fafaeaf908ef52fe23b588cb5fb2a9009f84381798
6
+ metadata.gz: 02363f08cb34ae5ccf3dea12d1ed8d2c1a4c586b2ba4cc16d3019ce1aca8441067bb3aa092e8dab2a7ff77cf3ecdebf51803399b262c186698b739fc485a8d3a
7
+ data.tar.gz: f657334321415dd36fb9e06d2d126b08c2e2c718b10062ad3dd11a2df9276fe631af07a7915a30c904f88c3e57bf85be8a0b1106157a6925df01e7f11451e69f
@@ -17,13 +17,32 @@ class CriterionDecorator < ApplicationDecorator
17
17
  self.class.status_description(object.status)
18
18
  end
19
19
 
20
+ # rubocop:disable MethodLength
20
21
  def update_summary
21
- if current_document
22
- "Updated #{h.time_ago_in_words(current_document.created_at)} ago"
23
- else
24
- 'Never updated'
22
+ case object.scope
23
+ when 'organization'
24
+ if current_document
25
+ "Updated #{h.time_ago_in_words(current_document.created_at)} ago"
26
+ else
27
+ 'Never updated'
28
+ end
29
+ when 'app'
30
+ count = unique_app_count
31
+ "Completed for #{count} #{'app'.pluralize(count)}"
32
+ when 'user'
33
+ count = unique_user_count
34
+ "Completed for #{count} #{'user'.pluralize(count)}"
25
35
  end
26
36
  end
37
+ # rubocop:enable MethodLength
38
+
39
+ def unique_user_count
40
+ object.documents.map { |d| d.links['user'].href }.uniq.count
41
+ end
42
+
43
+ def unique_app_count
44
+ object.documents.map { |d| d.links['app'].href }.uniq.count
45
+ end
27
46
 
28
47
  def current_document
29
48
  documents.first
@@ -1,5 +1,5 @@
1
1
  module Aptible
2
2
  module Rails
3
- VERSION = '0.4.5'
3
+ VERSION = '0.4.6'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aptible-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank Macreery
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-23 00:00:00.000000000 Z
11
+ date: 2014-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_config