diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs index b67e0f64..64246141 100644 --- a/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs @@ -165,9 +165,13 @@ namespace IRaCIS.Core.Application.Service UserCode = user.UserCode, UserName = user.UserName, UserTypeEnum = user.UserTypeRole.UserTypeEnum, - ReadingCategoryList = allocationRule.Enroll.EnrollReadingCategoryList.AsQueryable() - .WhereIf(selectQuery.ReadingCategory != null,t=> t.ReadingCategory == selectQuery.ReadingCategory) - .WhereIf(selectQuery.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == selectQuery.TrialReadingCriterionId) + + ReadingCategoryList = selectQuery.TrialReadingCriterionId == null ? + allocationRule.Enroll.EnrollReadingCategoryList + .Select(t => t.ReadingCategory).OrderBy(t => t).ToList(): + + allocationRule.Enroll.EnrollReadingCategoryList + .Where( t => t.TrialReadingCriterionId == selectQuery.TrialReadingCriterionId) .Select(t => t.ReadingCategory).OrderBy(t=>t).ToList() };