Class: Effective::CpdStatement
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Effective::CpdStatement
- Defined in:
- app/models/effective/cpd_statement.rb
Instance Attribute Summary collapse
-
#current_step ⇒ Object
Returns the value of attribute current_step.
-
#current_user ⇒ Object
Returns the value of attribute current_user.
Instance Method Summary collapse
- #carry_forward ⇒ Object
- #completed? ⇒ Boolean
- #in_progress? ⇒ Boolean
-
#score_per_category ⇒ Object
=> 20, category_id => 15.
-
#submit! ⇒ Object
This is the review step where they click Submit Ballot.
- #to_s ⇒ Object
Instance Attribute Details
#current_step ⇒ Object
Returns the value of attribute current_step.
4 5 6 |
# File 'app/models/effective/cpd_statement.rb', line 4 def current_step @current_step end |
#current_user ⇒ Object
Returns the value of attribute current_user.
3 4 5 |
# File 'app/models/effective/cpd_statement.rb', line 3 def current_user @current_user end |
Instance Method Details
#carry_forward ⇒ Object
90 91 92 |
# File 'app/models/effective/cpd_statement.rb', line 90 def carry_forward cpd_statement_activities.sum { |activity| activity.carry_forward.to_i } end |
#completed? ⇒ Boolean
86 87 88 |
# File 'app/models/effective/cpd_statement.rb', line 86 def completed? submitted_at.present? end |
#in_progress? ⇒ Boolean
82 83 84 |
# File 'app/models/effective/cpd_statement.rb', line 82 def in_progress? submitted_at.blank? end |
#score_per_category ⇒ Object
=> 20, category_id => 15
95 96 97 98 99 |
# File 'app/models/effective/cpd_statement.rb', line 95 def score_per_category @score_per_category ||= Hash.new(0).tap do |scores| cpd_statement_activities.each { |activity| scores[activity.cpd_category_id] += activity.score.to_i } end end |
#submit! ⇒ Object
This is the review step where they click Submit Ballot
76 77 78 79 80 |
# File 'app/models/effective/cpd_statement.rb', line 76 def submit! wizard_steps[:complete] ||= Time.zone.now update!(submitted_at: Time.zone.now) end |
#to_s ⇒ Object
71 72 73 |
# File 'app/models/effective/cpd_statement.rb', line 71 def to_s cpd_cycle.present? ? "#{cpd_cycle} Statement" : 'statement' end |