diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs index d0cc4f7a..fa496969 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs @@ -230,12 +230,14 @@ namespace BMA.EHR.Placement.Service.Controllers else if (role == "NORMAL") { placementAppointments = placementAppointments - .Where( - x => node == 0 ? x.child1DnaId == null - : (node == 1 ? x.child1DnaId != null && x.child2DnaId == null - : (node == 2 ? x.child2DnaId != null && x.child3DnaId == null - : (node == 3 ? x.child3DnaId != null && x.child4DnaId == null : true))) - ).ToList(); + .Where(x => + (node == 0 && x.child1DnaId == null && x.rootDnaId == nodeId) || + (node == 1 && x.child1DnaId != null && x.child2DnaId == null && x.child1DnaId == nodeId) || + (node == 2 && x.child2DnaId != null && x.child3DnaId == null && x.child2DnaId == nodeId) || + (node == 3 && x.child3DnaId != null && x.child4DnaId == null && x.child3DnaId == nodeId) || + (node == 4 && x.child4DnaId == nodeId) + ) + .ToList(); } return Success(placementAppointments); }