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
-
#build_cpd_statement(cpd_cycle:) ⇒ Object
Find or build.
- #cpd_audit_cpd_required? ⇒ Boolean
- #cpd_audit_reviewer? ⇒ Boolean
- #cpd_statement(cpd_cycle:) ⇒ Object
-
#cpd_statement_required_score(cpd_statement) ⇒ Object
This one will actually be enforced or displayed first.
-
#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.
Instance Method Details
#build_cpd_statement(cpd_cycle:) ⇒ Object
Find or build
66 67 68 69 |
# File 'app/models/concerns/effective_cpd_user.rb', line 66 def build_cpd_statement(cpd_cycle:) raise('expected an CpdCycle') unless cpd_cycle.class.respond_to?(:effective_cpd_cycle?) cpd_statement(cpd_cycle: cpd_cycle) || cpd_statements.build(cpd_cycle: cpd_cycle) end |
#cpd_audit_cpd_required? ⇒ Boolean
52 53 54 |
# File 'app/models/concerns/effective_cpd_user.rb', line 52 def cpd_audit_cpd_required? true end |
#cpd_audit_reviewer? ⇒ Boolean
56 57 58 |
# File 'app/models/concerns/effective_cpd_user.rb', line 56 def cpd_audit_reviewer? roles.include?(:cpd_audit_reviewer) end |
#cpd_statement(cpd_cycle:) ⇒ Object
60 61 62 63 |
# File 'app/models/concerns/effective_cpd_user.rb', line 60 def cpd_statement(cpd_cycle:) raise('expected an CpdCycle') unless cpd_cycle.class.respond_to?(:effective_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
42 43 44 |
# File 'app/models/concerns/effective_cpd_user.rb', line 42 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
48 49 50 |
# File 'app/models/concerns/effective_cpd_user.rb', line 48 def cpd_statement_targeted_score(cpd_statement) nil end |