Module: EmployeeTimeOffsHelper

Includes:
TimeOffPlannedWorkDayHelper
Included in:
EmployeeWorkSchedulesHelper
Defined in:
app/helpers/employee_time_offs_helper.rb

Overview

== Schema Information

Table name: employee_time_offs

id :integer not null, primary key
employee_id :integer
short_term_disability :integer
jury_duty :integer
bereavement :integer
created_at :datetime not null
updated_at :datetime not null
short_term_disability_used :integer
jury_duty_used :integer
bereavement_used :integer
birthday :integer
birthday_used :integer
not_working_timeoff :decimal(, )
not_working_timeoff_used :integer
banked_time_type :string
banked_time :integer default(0)
accumulated :integer
unpaid_timeoff_used :integer

Instance Method Summary collapse

Methods included from TimeOffPlannedWorkDayHelper

#time_off_planned_work_day_planned_hours, #time_off_planned_work_day_summary, #time_off_planned_work_day_usual_summary

Instance Method Details

#human_duration(duration_in_seconds) ⇒ Object



53
54
55
# File 'app/helpers/employee_time_offs_helper.rb', line 53

def human_duration(duration_in_seconds)
  Heatwave::Duration.humanize(duration_in_seconds.round, format: :long)
end

#humanize(seconds) ⇒ Object



29
30
31
32
33
# File 'app/helpers/employee_time_offs_helper.rb', line 29

def humanize(seconds)
  return if seconds.nil?

  Heatwave::Duration.humanize(seconds)
end

#humanize_partial_hours(date) ⇒ Object



41
42
43
44
45
# File 'app/helpers/employee_time_offs_helper.rb', line 41

def humanize_partial_hours(date)
  date.strftime("%I:%M %p")
rescue StandardError
  ""
end

#humanize_short(seconds) ⇒ Object



35
36
37
38
39
# File 'app/helpers/employee_time_offs_helper.rb', line 35

def humanize_short(seconds)
  return if seconds.nil?

  Heatwave::Duration.humanize(seconds, format: :short)
end

#integer_hours(seconds) ⇒ Object



47
48
49
50
51
# File 'app/helpers/employee_time_offs_helper.rb', line 47

def integer_hours(seconds)
  (seconds.to_f / 3600).to_f.round(2)
rescue StandardError
  0
end