woody-decorators 2.5.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/woody/decorators.rb +1 -1
- data/lib/woody/decorators/challenge.rb +14 -0
- data/lib/woody/decorators/submission.rb +7 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bb25f40b3a57d527127709e8b50a8ce1faafa21
|
4
|
+
data.tar.gz: 10b464d1910aeaa4e0d4c8be6c6b9d3405c6c4b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3aff26447d61dff8b6e8779918ecf6848eef5ecbf07dee226cf28a9e2606aef04886614303a8c202cd07f07b00585b440dd5eb88acbf485a84cab96a93f8db50
|
7
|
+
data.tar.gz: 8d23027f22ad98c7c05a88305a174afd4c969cf0512f5d7e4b5355ae547f6698e46d21d9060133d3cb7e16896143f695a06e8e841bad952ae010f317ad4bdcae
|
data/lib/woody/decorators.rb
CHANGED
@@ -7,6 +7,11 @@ require "woody/decorators/challenge_question"
|
|
7
7
|
module Woody
|
8
8
|
module Decorators
|
9
9
|
class Challenge < Base
|
10
|
+
def initialize(model, config)
|
11
|
+
@config = config
|
12
|
+
super(model)
|
13
|
+
end
|
14
|
+
|
10
15
|
def brand_name
|
11
16
|
brand.name
|
12
17
|
end
|
@@ -36,6 +41,15 @@ module Woody
|
|
36
41
|
@model.image_exists
|
37
42
|
end
|
38
43
|
|
44
|
+
def image_url
|
45
|
+
format(
|
46
|
+
"%s/%s/brands/campaign_image/%s",
|
47
|
+
@config.s3_domain,
|
48
|
+
@config.public_s3_bucket,
|
49
|
+
@model.short_hash
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
39
53
|
def reward_total
|
40
54
|
@model.rewards.inject(0) do |total, reward|
|
41
55
|
total + (reward.quantity * reward.amount)
|
@@ -5,9 +5,15 @@ require "woody/decorators/challenge"
|
|
5
5
|
module Woody
|
6
6
|
module Decorators
|
7
7
|
class Submission < Base
|
8
|
+
def initialize(model, config)
|
9
|
+
@config = config
|
10
|
+
super(model)
|
11
|
+
end
|
12
|
+
|
8
13
|
def challenge
|
9
14
|
@challenge ||= Woody::Decorators::Challenge.new(
|
10
|
-
Wes::Data::API::Challenge.find(:id, @model.challenge_id)
|
15
|
+
Wes::Data::API::Challenge.find(:id, @model.challenge_id),
|
16
|
+
@config
|
11
17
|
)
|
12
18
|
end
|
13
19
|
end
|