diff --git a/src/backend/api/Fusion.Resources.Domain/Queries/Departments/GetDepartmentPersonnel.cs b/src/backend/api/Fusion.Resources.Domain/Queries/Departments/GetDepartmentPersonnel.cs index b679f0376..e5cbea997 100644 --- a/src/backend/api/Fusion.Resources.Domain/Queries/Departments/GetDepartmentPersonnel.cs +++ b/src/backend/api/Fusion.Resources.Domain/Queries/Departments/GetDepartmentPersonnel.cs @@ -99,7 +99,7 @@ public async Task> Handle(GetDepartmen departmentPersonnel.ForEach(p => { // Filter out all positions of type products - p.PositionInstances = p.PositionInstances.Where(pis => !pis.BasePosition.ProjectType.Equals("Product")).ToList(); + p.PositionInstances = p.PositionInstances.Where(pis => pis.BasePosition != null && pis.BasePosition.ProjectType != null && !pis.BasePosition.ProjectType.Equals("Product")).ToList(); p.Absence = departmentAbsence[p.AzureUniqueId]; if (departmentRequests.ContainsKey(p.AzureUniqueId)) @@ -222,8 +222,6 @@ private async Task> GetDepartmentFromSearchIn if (managers.Any()) queryString += " or " + string.Join(" or ", managers.Select(m => $"managerAzureId eq '{m}' and isResourceOwner eq true")); - - var peopleClient = httpClientFactory.CreateClient(HttpClientNames.ApplicationPeople); var personnel = await PeopleSearchUtils.GetFromSearchIndexAsync(peopleClient, queryString, requests: requests);