Class: Effective::CpdStatementActivity

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#max_scoreObject

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

#destroyObject



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

Returns:



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

Returns:



69
70
71
# File 'app/models/effective/cpd_statement_activity.rb', line 69

def locked?
  is_carry_over? || cpd_statement&.completed?
end

#original_cycleObject



64
65
66
# File 'app/models/effective/cpd_statement_activity.rb', line 64

def original_cycle
  (original || self).cpd_statement.cpd_cycle
end

#reduced_messagesObject



56
57
58
# File 'app/models/effective/cpd_statement_activity.rb', line 56

def reduced_messages
  self[:reduced_messages] ||= {}
end

#to_debugObject



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_sObject



52
53
54
# File 'app/models/effective/cpd_statement_activity.rb', line 52

def to_s
  (cpd_activity || 'activity').to_s
end