Skip to content

Commit

Permalink
Merge pull request #2176 from frappe/mergify/bp/version-15-hotfix/pr-…
Browse files Browse the repository at this point in the history
…2173

fix(Monthly Attendance Sheet): consideration of None values while grouping (backport #2173)
  • Loading branch information
krantheman committed Sep 13, 2024
2 parents a16573e + 0e22d20 commit d0930a5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def get_employee_related_details(filters: Filters) -> tuple[dict, list]:
emp_map = {}

if group_by:
group_key = lambda d: d[group_by] # noqa
group_key = lambda d: "" if d[group_by] is None else d[group_by] # noqa
for parameter, employees in groupby(sorted(employee_details, key=group_key), key=group_key):
group_by_param_values.append(parameter)
emp_map.setdefault(parameter, frappe._dict())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ def test_attendance_with_group_by_filter(self):
mark_attendance(self.employee, previous_month_first + relativedelta(days=2), "On Leave")
mark_attendance(self.employee, previous_month_first + relativedelta(days=3), "Present")

departmentless_employee = make_employee(
"[email protected]", company=self.company, department=None
)
mark_attendance(departmentless_employee, previous_month_first + relativedelta(days=3), "Present")

filters = frappe._dict(
{
"month": previous_month_first.month,
Expand Down

0 comments on commit d0930a5

Please sign in to comment.