Class: Effective::ApplicantExperience

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/effective/applicant_experience.rb

Constant Summary collapse

LEVELS =
['Full Time', 'Part Time', 'Volunteer']
ONE_HUNDRED_PERCENT =
100_000

Instance Method Summary collapse

Instance Method Details

#assign_months!Object



52
53
54
55
56
57
58
59
60
61
# File 'app/models/effective/applicant_experience.rb', line 52

def assign_months!
  return 0 unless end_on.present? && start_on.present?

  self.percent_worked ||= (part_time? ? 0 : ONE_HUNDRED_PERCENT)

  months = ((end_on.end_of_day.to_time - start_on.to_time) / 1.month.second).ceil
  months *= (percent_worked / ONE_HUNDRED_PERCENT.to_f)

  self.months = months
end

#full_time?Boolean

Returns:

  • (Boolean)


67
68
69
# File 'app/models/effective/applicant_experience.rb', line 67

def full_time?
  level == 'Full Time'
end

#part_time?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'app/models/effective/applicant_experience.rb', line 71

def part_time?
  level == 'Part Time'
end

#percent_worked_to_sObject



63
64
65
# File 'app/models/effective/applicant_experience.rb', line 63

def percent_worked_to_s
  (percent_worked.to_i / 1000.to_f).to_i.to_s + '%'
end

#to_sObject



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

def to_s
  position.presence || model_name.human
end

#volunteer?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'app/models/effective/applicant_experience.rb', line 75

def volunteer?
  level == 'Volunteer'
end