Class: Effective::CpdStatement

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/effective/cpd_statement.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#current_stepObject

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_userObject

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_forwardObject



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

Returns:

  • (Boolean)


86
87
88
# File 'app/models/effective/cpd_statement.rb', line 86

def completed?
  .present?
end

#in_progress?Boolean

Returns:

  • (Boolean)


82
83
84
# File 'app/models/effective/cpd_statement.rb', line 82

def in_progress?
  .blank?
end

#score_per_categoryObject

=> 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_sObject



71
72
73
# File 'app/models/effective/cpd_statement.rb', line 71

def to_s
  cpd_cycle.present? ? "#{cpd_cycle} Statement" : 'statement'
end