Module: EffectiveCpdUser

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/effective_cpd_user.rb

Overview

EffectiveCpdUser

Mark your user model with effective_cpd_user to get a few helpers And user specific point required scores

Defined Under Namespace

Modules: Base, ClassMethods

Instance Method Summary collapse

Instance Method Details

#build_cpd_statement(cpd_cycle:) ⇒ Object

Find or build



47
48
49
50
# File 'app/models/concerns/effective_cpd_user.rb', line 47

def build_cpd_statement(cpd_cycle:)
  raise('expected an Effective::CpdCycle') unless cpd_cycle.class.respond_to?(:effective_cpd_cpd_cycle?)
  cpd_statement(cpd_cycle: cpd_cycle) || cpd_statements.build(cpd_cycle: cpd_cycle)
end

#cpd_audit_cpd_required?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'app/models/concerns/effective_cpd_user.rb', line 37

def cpd_audit_cpd_required?
  true
end

#cpd_statement(cpd_cycle:) ⇒ Object



41
42
43
44
# File 'app/models/concerns/effective_cpd_user.rb', line 41

def cpd_statement(cpd_cycle:)
  raise('expected an Effective::CpdCycle') unless cpd_cycle.class.respond_to?(:effective_cpd_cpd_cycle?)
  cpd_statements.find { |cpd_statement| cpd_statement.cpd_cycle_id == cpd_cycle.id }
end

#cpd_statement_required_score(cpd_statement) ⇒ Object

This one will actually be enforced or displayed first



27
28
29
# File 'app/models/concerns/effective_cpd_user.rb', line 27

def cpd_statement_required_score(cpd_statement)
  nil
end

#cpd_statement_targeted_score(cpd_statement) ⇒ Object

This one will be displayed on the sidebar if first one is nil Won’t actually block the submission



33
34
35
# File 'app/models/concerns/effective_cpd_user.rb', line 33

def cpd_statement_targeted_score(cpd_statement)
  nil
end