Skip to content

Commit

Permalink
fix(Auto Attendance): incorrect previous shift computation for a time…
Browse files Browse the repository at this point in the history
…stamp leading to incorrect absent marking
  • Loading branch information
ruchamahabal committed May 6, 2024
1 parent 0906abb commit cda77bb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion hrms/hr/doctype/shift_assignment/shift_assignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,11 @@ def get_prev_or_next_shift(
for date_range in shift_dates:
# midnight shifts will span more than a day
start_date, end_date = date_range[0], add_days(date_range[1], 1)
reverse = next_shift_direction == "reverse"

if reverse := (next_shift_direction == "reverse"):
end_date = min(end_date, for_timestamp.date())
elif next_shift_direction == "forward":
start_date = max(start_date, for_timestamp.date())

for dt in generate_date_range(start_date, end_date, reverse=reverse):
shift_details = get_employee_shift(
Expand Down

0 comments on commit cda77bb

Please sign in to comment.