Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions hr_shift/models/resource_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,15 @@ def _attendance_intervals_batch(
intervals_to_remove = []
resource_intervals = res[resource.id]._items
for shift in shifts:
# Remove any other interval that belongs to any of the dates of the
# shift (no matter the hours, as if the shift is around midnight,
# there will be a mix of 2 dates)
intervals_to_remove += [
(start, end, resource_item)
for start, end, resource_item in resource_intervals
if (
shift.start_time
>= datetime.combine(start, start.min.time())
and shift.end_time >= datetime.combine(end, end.min.time())
shift.start_time.date() == start.date()
or shift.end_time.date() == end.date()
)
]
start_time = string_to_datetime(shift.start_time).astimezone(tz)
Expand Down