woody-decorators 7.7.1 → 7.8.0

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: dda4259d775b94f47530188efeaa2a3eb9b9782d
4
- data.tar.gz: 4d2d7a1cd379e9100e6f50e86af4408be2fce716
3
+ metadata.gz: f83f028be973d1bdcfe71b405e55b281f0d36628
4
+ data.tar.gz: 7e08bb3b1ee65aa6035ac9cf34a1afeff255ce07
5
5
  SHA512:
6
- metadata.gz: cf01f85735e6bdd5828ae417513c7f3f29d0404367c5dbc84c2769386063becc1cc7f33a3e0fec7911ef4ff8b21d740c1ec3c10fd88eff66b51e0bb05474c594
7
- data.tar.gz: 2b8f48e8d7615a3d906c73a4da150ff8b6a4ed04d5bbde939ed12c89a9aa9dc9ad9a2c11ba161f23b7f321b704d5fed3b0155f006f14542a2554523ed4065837
6
+ metadata.gz: 985e54adab4a4d173bc113fda5ac9aadfa0a80a4a168b69e396064f6e4abb6faa91951ce724d27e4938c80a81e5cd5a727413122ac0cb3e4f1b25201f2860ab7
7
+ data.tar.gz: 92049bf72be4e595863ccc738195132d1bc165a36c6a49b25e1c802f984b8a4522055b58cc8c89fd6403cd1884ce1f10f8ca1d3f15f340d6a6fafbfb92394750
@@ -1,5 +1,5 @@
1
1
  module Woody
2
2
  module Decorators
3
- VERSION = '7.7.1'.freeze
3
+ VERSION = '7.8.0'.freeze
4
4
  end
5
5
  end
@@ -70,6 +70,16 @@ module Woody
70
70
  purchased_videos > 0 ? 'Complete' : 'Video Review'
71
71
  end
72
72
 
73
+ def brand_status
74
+ return 'In Development' if @model.status == 'draft' || @model.end_date.nil?
75
+ return 'Live' if is_live?
76
+ purchased_videos > 0 ? 'Complete' : 'Video Review'
77
+ end
78
+
79
+ def brand_status_identifier
80
+ brand_status.downcase.gsub(' ', '-')
81
+ end
82
+
73
83
  def time_left
74
84
  Time.diff(DateTime.now, @model.end_date, '%d %H')[:diff]
75
85
  end
@@ -115,6 +125,15 @@ module Woody
115
125
 
116
126
  DATE_FORMAT = '%Y/%m/%d %H:%M'
117
127
 
128
+ def is_live?
129
+ DateTime.parse(@model.end_date) > DateTime.now &&
130
+ (selected_videos == 0 && purchased_videos == 0)
131
+ end
132
+
133
+ def selected_videos
134
+ @selected_videos ||= @model.videos(state: 'selected').size
135
+ end
136
+
118
137
  def purchased_videos
119
138
  @purchased_videos ||= @model.videos(state: 'purchased').size
120
139
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: woody-decorators
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.7.1
4
+ version: 7.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-15 00:00:00.000000000 Z
11
+ date: 2016-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler