P-132
This commit is contained in:
1 parent
393d9d1871
commit
8b78748d8f
1 file changed
+4
-2
@@ -220,8 +220,10 @@ def get_employees_serializer(ids):
|
||||
|
||||
def set_real_departments(employees):
|
||||
employee_departments = EmployeeDepartment.objects.filter(employee__in=employees)
|
||||
department_map = {ed.employee.id: ed.department for ed in employee_departments}
|
||||
departments = DictDepartment.objects.in_bulk([ed.department.id for ed in employee_departments])
|
||||
department_map = {ed.employee.id: {'name': ed.department.name, 'id': departments[ed.department.id]} for ed in employee_departments}
|
||||
|
||||
for employee in employees:
|
||||
if employee.id in department_map:
|
||||
employee.department = department_map[employee.id]
|
||||
employee.department = department_map[employee.id]['name']
|
||||
employee.id_dict_department = department_map[employee.id]['id']
|
||||
Reference in new issue
Block a user