woody-decorators 12.1.1 → 12.1.2

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
- SHA1:
3
- metadata.gz: 9a5f985211ed28ec6973a598754627667ee91d51
4
- data.tar.gz: 21973360ff1ba6dc871e5f5a21cf4e9e19397938
2
+ SHA256:
3
+ metadata.gz: c07ea21409c8a207d3af94d0e0987a0407070223a058a469532cf60b81420531
4
+ data.tar.gz: e59f96610935a502f604294cb5d2a5b121bfbbad6a6ba8636a7ecb55b2d5c553
5
5
  SHA512:
6
- metadata.gz: 22f481e034d3291ae26f32252d8a38f72d5f55912e28d832813847dedc29957cbb650677f5d35e9adec07c354e1ecca8ae79930e297611b19189159c21e80040
7
- data.tar.gz: f265c8a68edbf028617eebf07493fab5fce6441b553e856f54703b8098966a0cfa937e0bbb3331360dd3d455afae5a5a314e1558005aa4fbbcfb9ca5b86670d2
6
+ metadata.gz: c47c712464370f5fdbe124c98bad383fb9aa8ec79da010e6e599b3d8ce785e2b2b171c0474166b75f37f52c791c53b59d51dd8baddc05407ea7497e2f5477530
7
+ data.tar.gz: 2e9e6f30c57e6742e68c9b2b5cfd930f778a99ff8c2fa3c467677076a82043fc82ab2125b105bac4cc3e39d0f8de9da1ed667328c97109b1e8cd99149446699a
@@ -1,5 +1,5 @@
1
1
  module Woody
2
2
  module Decorators
3
- VERSION = '12.1.1'.freeze
3
+ VERSION = '12.1.2'.freeze
4
4
  end
5
5
  end
@@ -28,7 +28,7 @@ module Woody
28
28
  def brand_status
29
29
  return 'In Development' if @model.status == 'draft' || @model.end_date.nil?
30
30
  return 'Live' if is_live?
31
- purchased_videos > 0 ? 'Complete' : 'Video Review'
31
+ 'Complete'
32
32
  end
33
33
 
34
34
  def brand_status_identifier
@@ -70,25 +70,11 @@ module Woody
70
70
  end
71
71
 
72
72
  def draft?
73
- case @model.category
74
- when 'brand'
75
- @model.status == 'draft' || @model.end_date.nil?
76
- when 'squad', 'vidsy'
77
- @model.status == 'draft'
78
- end
73
+ @model.status == 'draft' || @model.end_date.nil?
79
74
  end
80
75
 
81
76
  def ended?(submission = nil)
82
- case @model.category
83
- when 'brand'
84
- @model.status == 'published' &&
85
- parsed_end_date < DateTime.now
86
- when 'vidsy'
87
- @model.status == 'published' &&
88
- parsed_end_date(submission) < DateTime.now
89
- when 'squad'
90
- false
91
- end
77
+ @model.status == 'published' && parsed_end_date < DateTime.now
92
78
  end
93
79
 
94
80
  def essentials_questions
@@ -123,43 +109,8 @@ module Woody
123
109
  )
124
110
  end
125
111
 
126
- def insights_post(yml_config, post_id)
127
- post = @model.insights('posts').find do |p|
128
- p['post_id'] == post_id
129
- end
130
-
131
- return nil unless post
132
-
133
- {
134
- post: Insights::Hydrator.hydrate(yml_config, post)
135
- }
136
- end
137
-
138
- def insights_posts_list(yml_config)
139
- {
140
- posts: Insights::Hydrator.hydrate_array(
141
- yml_config, sorted_posts
142
- )
143
- }
144
- end
145
-
146
- def insights_summary(yml_config)
147
- {
148
- summary: Insights::Hydrator.hydrate(
149
- yml_config, @model.insights('summary')
150
- )
151
- }
152
- end
153
-
154
112
  def parsed_end_date(submission = nil)
155
- case @model.category
156
- when 'brand'
157
- DateTime.parse(@model.end_date)
158
- when 'vidsy'
159
- DateTime.parse(submission.created_at).advance(hours: @model.duration)
160
- when 'squad'
161
- nil
162
- end
113
+ DateTime.parse(@model.end_date)
163
114
  end
164
115
 
165
116
  def public?
@@ -167,24 +118,13 @@ module Woody
167
118
  end
168
119
 
169
120
  def status(submission = nil)
170
- case @model.category
171
- when 'brand'
172
- brand_category_status
173
- when 'vidsy'
174
- vidsy_category_status(submission)
175
- when 'squad'
176
- squad_category_status(submission)
177
- end
121
+ return 'Draft' if draft?
122
+ return time_remaining if DateTime.parse(@model.end_date) > DateTime.now
123
+ 'Complete'
178
124
  end
179
125
 
180
126
  def time_left(submission = nil)
181
- case @model.category
182
- when 'brand'
183
- Time.diff(DateTime.now, @model.end_date, '%d %H')[:diff]
184
- when 'vidsy'
185
- end_date = DateTime.parse(submission.created_at).advance(hours: @model.duration)
186
- Time.diff(DateTime.now, end_date, '%d %H')[:diff]
187
- end
127
+ Time.diff(DateTime.now, @model.end_date, '%d %H')[:diff]
188
128
  end
189
129
 
190
130
  def time_remaining(submission = nil)
@@ -232,23 +172,12 @@ module Woody
232
172
 
233
173
  DATE_FORMAT = '%Y/%m/%d %H:%M'
234
174
 
235
- def brand_category_status
236
- return 'Draft' if draft?
237
- return time_remaining if DateTime.parse(@model.end_date) > DateTime.now
238
- purchased_videos > 0 ? 'Complete' : 'Video Review'
239
- end
240
-
241
175
  def fetch_video_partner_assets
242
176
  @video_partner_assets = @model.video_partner_assets
243
177
  end
244
178
 
245
179
  def is_live?
246
- DateTime.parse(@model.end_date) > DateTime.now &&
247
- (selected_videos == 0 && purchased_videos == 0)
248
- end
249
-
250
- def purchased_videos
251
- @purchased_videos ||= @model.videos(state: 'purchased').size
180
+ DateTime.parse(@model.end_date) > DateTime.now
252
181
  end
253
182
 
254
183
  def questions
@@ -257,10 +186,6 @@ module Woody
257
186
  end.group_by(&:section)
258
187
  end
259
188
 
260
- def selected_videos
261
- @selected_videos ||= @model.videos(state: 'selected').size
262
- end
263
-
264
189
  def sorted_posts
265
190
  @model.insights('posts').sort do |a, b|
266
191
  DateTime.parse(b['data']['created_timestamp']) <=>
@@ -268,25 +193,9 @@ module Woody
268
193
  end
269
194
  end
270
195
 
271
- def squad_category_status(submission)
272
- case submission.state
273
- when 'pending'
274
- 'Awaiting Approval'
275
- when 'declined'
276
- 'More spaces opening soon!'
277
- when 'approved'
278
- 'Active'
279
- end
280
- end
281
-
282
196
  def truncate(s, i)
283
197
  format('%s...', s[0..i])
284
198
  end
285
-
286
- def vidsy_category_status(submission)
287
- return 'Complete' if ended?(submission)
288
- time_remaining(submission)
289
- end
290
199
  end
291
200
  end
292
201
  end
@@ -24,10 +24,6 @@ module Woody
24
24
  : format('http://%s', @model.portfolio)
25
25
  end
26
26
 
27
- def portfolio_url
28
- format('/u/%s', @model.portfolio_username)
29
- end
30
-
31
27
  def short_portfolio
32
28
  parsed_url = URI.parse(@model.portfolio)
33
29
  return parsed_url.host.downcase if parsed_url.host
@@ -12,8 +12,8 @@ module Woody
12
12
  def avatar(platform)
13
13
  invalid_platform(platform) unless %w(creator brands).include?(platform)
14
14
  return user_avatar(platform: platform) if platform == 'brands'
15
- @model.onboarded ? user_avatar(platform: platform, cache_bust: true)
16
- : default_avatar(platform)
15
+ return default_avatar(platform) if @model.first_name == ''
16
+ user_avatar(platform: platform, cache_bust: true)
17
17
  end
18
18
 
19
19
  def exist?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: woody-decorators
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.1.1
4
+ version: 12.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -207,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
207
  version: '0'
208
208
  requirements: []
209
209
  rubyforge_project:
210
- rubygems_version: 2.5.2.3
210
+ rubygems_version: 2.7.6
211
211
  signing_key:
212
212
  specification_version: 4
213
213
  summary: ''