Class: Effective::CpdStatementActivity
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Effective::CpdStatementActivity
- Defined in:
- app/models/effective/cpd_statement_activity.rb
Instance Attribute Summary collapse
-
#max_score ⇒ Object
Returns the value of attribute max_score.
Instance Method Summary collapse
- #destroy ⇒ Object
- #is_carry_over? ⇒ Boolean
-
#locked? ⇒ Boolean
Will display as read-only on form.
- #original_cycle ⇒ Object
- #reduced_messages ⇒ Object
- #to_debug ⇒ Object
- #to_s ⇒ Object
Instance Attribute Details
#max_score ⇒ Object
Returns the value of attribute max_score.
3 4 5 |
# File 'app/models/effective/cpd_statement_activity.rb', line 3 def max_score @max_score end |
Instance Method Details
#destroy ⇒ Object
46 47 48 49 50 |
# File 'app/models/effective/cpd_statement_activity.rb', line 46 def destroy return false if cpd_statement.completed? return false unless cpd_statement.cpd_cycle.available? super end |
#is_carry_over? ⇒ Boolean
60 61 62 |
# File 'app/models/effective/cpd_statement_activity.rb', line 60 def is_carry_over? original.present? end |
#locked? ⇒ Boolean
Will display as read-only on form
69 70 71 |
# File 'app/models/effective/cpd_statement_activity.rb', line 69 def locked? is_carry_over? || cpd_statement&.completed? end |
#original_cycle ⇒ Object
64 65 66 |
# File 'app/models/effective/cpd_statement_activity.rb', line 64 def original_cycle (original || self).cpd_statement.cpd_cycle end |
#reduced_messages ⇒ Object
56 57 58 |
# File 'app/models/effective/cpd_statement_activity.rb', line 56 def self[:reduced_messages] ||= {} end |
#to_debug ⇒ Object
73 74 75 |
# File 'app/models/effective/cpd_statement_activity.rb', line 73 def to_debug "id=#{id}, score=#{score}, carry_foward=#{carry_forward}, carry_from_last=#{carry_over}, original=#{original&.id}" end |
#to_s ⇒ Object
52 53 54 |
# File 'app/models/effective/cpd_statement_activity.rb', line 52 def to_s (cpd_activity || 'activity').to_s end |