Module: EffectiveCpdHelper

Included in:
Effective::CpdScorer, Effective::CpdStatementsController
Defined in:
app/helpers/effective_cpd_helper.rb

Instance Method Summary collapse

Instance Method Details

#cpd_audit_labelObject



31
32
33
# File 'app/helpers/effective_cpd_helper.rb', line 31

def cpd_audit_label
  et(EffectiveCpd.CpdAudit)
end

#cpd_audit_level_labelObject



63
64
65
# File 'app/helpers/effective_cpd_helper.rb', line 63

def cpd_audit_level_label
  et(EffectiveCpd.CpdAuditLevel)
end

#cpd_audit_levels_labelObject



67
68
69
# File 'app/helpers/effective_cpd_helper.rb', line 67

def cpd_audit_levels_label
  ets(EffectiveCpd.CpdAuditLevel)
end

#cpd_audit_review_labelObject



39
40
41
# File 'app/helpers/effective_cpd_helper.rb', line 39

def cpd_audit_review_label
  et(EffectiveCpd.CpdAuditReview)
end

#cpd_audit_reviews_labelObject



43
44
45
# File 'app/helpers/effective_cpd_helper.rb', line 43

def cpd_audit_reviews_label
  ets(EffectiveCpd.CpdAuditReview)
end

#cpd_auditee_labelObject



47
48
49
# File 'app/helpers/effective_cpd_helper.rb', line 47

def cpd_auditee_label
  et(EffectiveCpd.CpdAudit, :user)
end

#cpd_auditees_labelObject



51
52
53
# File 'app/helpers/effective_cpd_helper.rb', line 51

def cpd_auditees_label
  ets(EffectiveCpd.CpdAudit, :user)
end

#cpd_audits_labelObject



35
36
37
# File 'app/helpers/effective_cpd_helper.rb', line 35

def cpd_audits_label
  ets(EffectiveCpd.CpdAudit)
end

#cpd_credit_labelObject



7
8
9
# File 'app/helpers/effective_cpd_helper.rb', line 7

def cpd_credit_label
  et('effective_cpd.credit')
end

#cpd_credits_labelObject



11
12
13
# File 'app/helpers/effective_cpd_helper.rb', line 11

def cpd_credits_label
  ets('effective_cpd.credit')
end

#cpd_cycle_labelObject



15
16
17
# File 'app/helpers/effective_cpd_helper.rb', line 15

def cpd_cycle_label
  et(Effective::CpdCycle)
end

#cpd_cycles_labelObject



19
20
21
# File 'app/helpers/effective_cpd_helper.rb', line 19

def cpd_cycles_label
  ets(Effective::CpdCycle)
end

#cpd_name_labelObject



3
4
5
# File 'app/helpers/effective_cpd_helper.rb', line 3

def cpd_name_label
  et('effective_cpd.name')
end

#cpd_reviewer_labelObject



55
56
57
# File 'app/helpers/effective_cpd_helper.rb', line 55

def cpd_reviewer_label
  et(EffectiveCpd.CpdAuditReview, :user)
end

#cpd_reviewers_labelObject



59
60
61
# File 'app/helpers/effective_cpd_helper.rb', line 59

def cpd_reviewers_label
  ets(EffectiveCpd.CpdAuditReview, :user)
end

#cpd_rule_formula_hint(cpd_activity) ⇒ Object



79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'app/helpers/effective_cpd_helper.rb', line 79

def cpd_rule_formula_hint(cpd_activity)
  raise('expected a CPDActivity') unless cpd_activity.kind_of?(Effective::CpdActivity)

  if cpd_activity.amount_label.present? && cpd_activity.amount2_label.present?
    "must include 'amount' and 'amount2'. Something like (amount + (amount2 * 10))"
  elsif cpd_activity.amount_label.present?
    "must include 'amount'. Something like (10 * amount)"
  elsif cpd_activity.amount2_label.present?
    "must include 'amount2'. Something like (10 * amount2)"
  else
    "must be a number and may not include 'amount'. Something like 10"
  end
end

#cpd_score(value, value2 = nil) ⇒ Object



107
108
109
110
111
112
# File 'app/helpers/effective_cpd_helper.rb', line 107

def cpd_score(value, value2 = nil)
  score1 = ("%.#{2}f" % value.to_d)
  score2 = ("%.#{2}f" % value2.to_d)

  (value.present? && value2.present?) ? "#{score1} / #{score2}" : score1
end

#cpd_statement_labelObject



23
24
25
# File 'app/helpers/effective_cpd_helper.rb', line 23

def cpd_statement_label
  et(EffectiveCpd.CpdStatement)
end

#cpd_statement_submit_label(cpd_statement) ⇒ Object



93
94
95
96
97
98
99
100
101
# File 'app/helpers/effective_cpd_helper.rb', line 93

def cpd_statement_submit_label(cpd_statement)
  label = "Yes, I understand I will not be able to submit more #{cpd_credits_label} or modify any of my activities for this #{cpd_cycle_label}, once I submit."

  if (end_at = cpd_statement.cpd_cycle.end_at).present?
    label += " The last date to submit this form is #{end_at.strftime("%B %d, %Y")}."
  end

  label
end

#cpd_statements_labelObject



27
28
29
# File 'app/helpers/effective_cpd_helper.rb', line 27

def cpd_statements_label
  ets(EffectiveCpd.CpdStatement)
end

#cpd_target_labelObject



71
72
73
# File 'app/helpers/effective_cpd_helper.rb', line 71

def cpd_target_label
  et(Effective::CpdTarget)
end

#cpd_targets_labelObject



75
76
77
# File 'app/helpers/effective_cpd_helper.rb', line 75

def cpd_targets_label
  ets(Effective::CpdTarget)
end

#effective_cpd_categoriesObject



103
104
105
# File 'app/helpers/effective_cpd_helper.rb', line 103

def effective_cpd_categories
  @effective_cpd_categories ||= Effective::CpdCategory.deep.sorted
end