Class: HrLite::AttendanceRecord

Inherits:
ApplicationRecord show all
Defined in:
app/models/hr_lite/attendance_record.rb

Constant Summary collapse

STATUSES =
%w[present half_day].freeze

Instance Method Summary collapse

Instance Method Details

#add_flag!(note) ⇒ Object



27
28
29
30
# File 'app/models/hr_lite/attendance_record.rb', line 27

def add_flag!(note)
  self.flagged = true
  self.flag_note = [ flag_note.presence, note ].compact.join("; ")
end

#regularized?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'app/models/hr_lite/attendance_record.rb', line 17

def regularized?
  regularized_at.present?
end

#worked_durationObject



21
22
23
24
25
# File 'app/models/hr_lite/attendance_record.rb', line 21

def worked_duration
  return nil unless check_in_at && check_out_at

  check_out_at - check_in_at
end