diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/GetReadModuleDto.cs b/IRaCIS.Core.Application/Service/Reading/Dto/GetReadModuleDto.cs index 1941611e6..21b91b3b7 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/GetReadModuleDto.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/GetReadModuleDto.cs @@ -40,8 +40,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public string? Name { get; set; } - - public Guid? TrialReadingCriterionId { get; set; } + [NotDefault] + public Guid TrialReadingCriterionId { get; set; } } diff --git a/IRaCIS.Core.Application/Service/Reading/ReadModuleService.cs b/IRaCIS.Core.Application/Service/Reading/ReadModuleService.cs index cb740208f..2f09f259a 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadModuleService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadModuleService.cs @@ -76,15 +76,14 @@ namespace IRaCIS.Application.Services #region MyRegion dto.SortField = dto.SortField.IsNullOrEmpty() ? nameof(ReadModuleView.TrialSiteCode) : dto.SortField; dto.SortField = dto.Asc ? dto.SortField : dto.SortField + " desc"; - var subjectQuery = _readModuleViewRepository.WhereIf(dto.TrialId != null, x => x.TrialId == dto.TrialId) + var subjectQuery = _readModuleViewRepository.Where(x => x.TrialReadingCriterionId == dto.TrialReadingCriterionId) + .WhereIf(dto.TrialId != null, x => x.TrialId == dto.TrialId) .WhereIf(dto.SubjectId != null, x => x.SubjectId == dto.SubjectId) .WhereIf(dto.TrialSiteCode != null && dto.TrialSiteCode != string.Empty, x => x.TrialSiteCode == dto.TrialSiteCode) .WhereIf(dto.SubjectCode != null && dto.SubjectCode != string.Empty, x => x.SubjectCode == dto.SubjectCode) .WhereIf(dto.ModuleType != null, x => x.ModuleType == dto.ModuleType) .WhereIf(dto.ReadingStatus != null, x => x.ReadingStatus == dto.ReadingStatus) - .WhereIf(dto.Name != null, x => x.Name.Contains(dto.Name!)).OrderBy(x => x.SiteCode) - - /*.WhereIf(dto.TrialReadingCriterionId != null, x => x.TrialReadingCriterionId== dto.TrialReadingCriterionId)*/; + .WhereIf(dto.Name != null, x => x.Name.Contains(dto.Name!)).OrderBy(x => x.SiteCode); var subjectIds = await subjectQuery.OrderBy(dto.SortField).Select(x => x.SubjectId).Distinct().Skip((dto.PageIndex - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();