Module: EmployeeTimeOffsHelper
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
#time_off_planned_work_day_summary
Instance Method Details
#human_duration(duration_in_seconds) ⇒ Object
48
49
50
51
52
|
# File 'app/helpers/employee_time_offs_helper.rb', line 48
def human_duration(duration_in_seconds)
n = duration_in_seconds.round
require 'chronic_duration'
ChronicDuration.output(n, format: :long)
end
|
#humanize(seconds) ⇒ Object
28
29
30
31
32
|
# File 'app/helpers/employee_time_offs_helper.rb', line 28
def humanize seconds
return if seconds.nil?
require 'chronic_duration'
ChronicDuration.output(seconds)
end
|
#humanize_partial_hours(date) ⇒ Object
40
41
42
|
# File 'app/helpers/employee_time_offs_helper.rb', line 40
def humanize_partial_hours date
date.strftime("%I:%M %p") rescue ""
end
|
#humanize_short(seconds) ⇒ Object
34
35
36
37
38
|
# File 'app/helpers/employee_time_offs_helper.rb', line 34
def humanize_short seconds
return if seconds.nil?
require 'chronic_duration'
ChronicDuration.output(seconds, format: :short)
end
|
#integer_hours(seconds) ⇒ Object
44
45
46
|
# File 'app/helpers/employee_time_offs_helper.rb', line 44
def integer_hours seconds
(seconds.to_f / 3600).to_f.round(2) rescue 0
end
|