Class: Woody::Decorators::Challenge
- Inherits:
-
Base
- Object
- Base
- Woody::Decorators::Challenge
show all
- Defined in:
- lib/woody/decorators/challenge.rb
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #method_missing
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Woody::Decorators::Base
Instance Method Details
#brand_name ⇒ Object
7
8
9
|
# File 'lib/woody/decorators/challenge.rb', line 7
def brand_name
brand.name
end
|
#reward_total ⇒ Object
11
12
13
14
15
|
# File 'lib/woody/decorators/challenge.rb', line 11
def reward_total
@model.rewards.inject(0) do |total, reward|
total + (reward.quantity * reward.amount)
end
end
|
#status ⇒ Object
17
18
19
20
21
|
# File 'lib/woody/decorators/challenge.rb', line 17
def status
return "Draft" if @model.status == "draft"
return "Live" if DateTime.parse(@model.end_date) > DateTime.now
purchased_videos > 0 ? "Complete" : "Video Review"
end
|