Module: EffectiveWorkExperienceHelper

Defined in:
app/helpers/effective_work_experience_helper.rb

Instance Method Summary collapse

Instance Method Details

#work_experience_hours_to_s(hours) ⇒ Object

Display hours with one decimal place



4
5
6
7
# File 'app/helpers/effective_work_experience_helper.rb', line 4

def work_experience_hours_to_s(hours)
  return if hours.blank?
  "%0.1f" % hours
end

#work_experience_recommendation_collectionObject



42
43
44
# File 'app/helpers/effective_work_experience_helper.rb', line 42

def work_experience_recommendation_collection
  Array(EffectiveWorkExperience.recommendations)
end

#work_experience_summary_start_on_collection(work_experience_summary = nil) ⇒ Object

Display a collection of every summary period going back 10 years



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/helpers/effective_work_experience_helper.rb', line 10

def work_experience_summary_start_on_collection(work_experience_summary = nil)
  disabled = if work_experience_summary.present?
    work_experience_summary.user.work_experience_summaries.where.not(id: work_experience_summary.id).pluck(:start_on)
  end

  disabled ||= []

  date = Time.zone.now.beginning_of_quarter
  end_date = (date - 10.years).beginning_of_year

  collection = []

  while date >= end_date
    start_on = date.beginning_of_quarter
    end_on = date.end_of_quarter

    collection << [
      "#{start_on.strftime('%B %Y')} to #{end_on.strftime('%B %Y')}",
      date.strftime('%Y-%m-%d'),
      disabled: disabled.include?(date)
    ]

    date -= 3.months
  end

  collection
end

#work_experience_summary_status_collectionObject



38
39
40
# File 'app/helpers/effective_work_experience_helper.rb', line 38

def work_experience_summary_status_collection
  EffectiveWorkExperience.WorkExperienceSummary::STATUSES
end