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

#is_carry_over?Boolean

Returns:

  • (Boolean)


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

def is_carry_over?
  original.present?
end

#locked?Boolean

Will display as read-only on form

Returns:

  • (Boolean)


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

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

#original_cycleObject



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

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

#reduced_messagesObject



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

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

#reportable_scopesObject

effective_reports



48
49
50
# File 'app/models/effective/cpd_statement_activity.rb', line 48

def reportable_scopes
  { draft: nil, completed: nil }
end

#to_debugObject



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

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

#to_sObject



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

def to_s
  cpd_activity.to_s.presence || model_name.human
end