-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat: filter unmarked attendance by shift in employee attendance tool #3362 #3363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
"column_break_gmhs", | ||
"late_entry", | ||
"early_exit", | ||
"section_break_ackd", | ||
"company", | ||
"branch", | ||
"department", | ||
"shift", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good problem to solve, although the UX could be improved.
Shifting shift field from the top section to filters could be confusing to users who don't fetch employees by shift and need to set one while marking attendance. Good problem to solve, although the UX could be improved.
Instead of moving shift field, maybe add separate field called "Assigned Shift" in the filters section. Or add a checkbox that says "Filter employees by Shift" which would then use the value set in shift to filter employees. Just thinking out loud here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback.
I will work on changes
shift_assigned_employees = frappe.get_list( | ||
'Shift Assignment', | ||
filters={ | ||
'shift_type': shift, | ||
'start_date': ['<=', frappe.utils.getdate(date)], | ||
'end_date': ['>=', frappe.utils.getdate(date)] | ||
}, | ||
fields=['employee'] | ||
) | ||
assigned_employee_ids = {emp['employee'] for emp in shift_assigned_employees} | ||
|
||
# Filter unmarked attendance based on assigned employees | ||
shiftwise_unmarked_attendance = [] | ||
for emp in unmarked_attendance: | ||
if emp['employee'] in assigned_employee_ids: | ||
shiftwise_unmarked_attendance.append(emp) | ||
|
||
return shiftwise_unmarked_attendance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also excludes default shifts that are set in the employee master.
Closes #3362
_get_unmarked_attendance_with_shift()
to fetch the employees based on shift assignmentMoved the

Shift
field in filters sectionHR.PR.mp4