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

#importingObject

Returns the value of attribute importing.



4
5
6
# File 'app/models/effective/cpd_statement_activity.rb', line 4

def importing
  @importing
end

#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



60
61
62
63
64
# File 'app/models/effective/cpd_statement_activity.rb', line 60

def destroy
  return false if cpd_statement.completed?
  return false unless cpd_statement.cpd_cycle.available?
  super
end

#is_carry_over?Boolean

Returns:

  • (Boolean)


74
75
76
# File 'app/models/effective/cpd_statement_activity.rb', line 74

def is_carry_over?
  original.present?
end

#locked?Boolean

Will display as read-only on form

Returns:

  • (Boolean)


83
84
85
# File 'app/models/effective/cpd_statement_activity.rb', line 83

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

#original_cycleObject



78
79
80
# File 'app/models/effective/cpd_statement_activity.rb', line 78

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

#reduced_messagesObject



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

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

#to_debugObject



87
88
89
# File 'app/models/effective/cpd_statement_activity.rb', line 87

def to_debug
  "id=#{id}, score=#{score}, carry_foward=#{carry_forward}, carry_from_last=#{carry_over}, original=#{original&.id}"
end

#to_sObject



66
67
68
# File 'app/models/effective/cpd_statement_activity.rb', line 66

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