fix: IN time not captured in Attendance through Employee Checkin (#31029)
This commit is contained in:
parent
af1eab5d54
commit
1b7ce9649b
@ -227,11 +227,15 @@ def calculate_working_hours(logs, check_in_out_type, working_hours_calc_type):
|
||||
in_log = out_log = None
|
||||
if not in_log:
|
||||
in_log = log if log.log_type == "IN" else None
|
||||
if in_log and not in_time:
|
||||
in_time = in_log.time
|
||||
elif not out_log:
|
||||
out_log = log if log.log_type == "OUT" else None
|
||||
|
||||
if in_log and out_log:
|
||||
out_time = out_log.time
|
||||
total_hours += time_diff_in_hours(in_log.time, out_log.time)
|
||||
|
||||
return total_hours, in_time, out_time
|
||||
|
||||
|
||||
|
@ -125,6 +125,11 @@ class TestEmployeeCheckin(FrappeTestCase):
|
||||
)
|
||||
self.assertEqual(working_hours, (4.5, logs_type_2[1].time, logs_type_2[-1].time))
|
||||
|
||||
working_hours = calculate_working_hours(
|
||||
[logs_type_2[1], logs_type_2[-1]], check_in_out_type[1], working_hours_calc_type[1]
|
||||
)
|
||||
self.assertEqual(working_hours, (5.0, logs_type_2[1].time, logs_type_2[-1].time))
|
||||
|
||||
def test_fetch_shift(self):
|
||||
employee = make_employee("test_employee_checkin@example.com", company="_Test Company")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user