refactor: fetch all employees that may have shift type as active shift (backport #2683) #2688
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Some employees would miss out while marking attendance for a shift due to filters set to exclude employees that have any other active shift assignment.
#2602 was pushed to rectify this, but it would exclude employees with the same active and default shift (this is a whole other can of worms) entirely.
Solution
Refactored to fetch all such employees who either have shift in question assigned that hasn't ended or have this shift as default shift. This may fetch some redundant employees who have another shift assigned that may have started or ended before or after the attendance processing date.
But this is done to avoid missing any employee who may have this shift as active shift.
Had added a test case with #2602.
Improved test scenario for
hrms/hrms/hr/doctype/shift_type/test_shift_type.py
Line 343 in b6f3100
Caveats
Could affect performance but better than having incorrect attendance records?
This is an automatic backport of pull request #2683 done by Mergify.