diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs index 485bc75a..5a69ddcf 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs @@ -296,7 +296,7 @@ namespace IRaCIS.Application.Services { var readingTaskState = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Select(x => x.ReadingTaskState).FirstOrDefaultAsync(); - var query= from data in _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId==inDto.ReadingQuestionCriterionTrialId&&x.Type!= "group") + var query= from data in _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId==inDto.ReadingQuestionCriterionTrialId) join questionAnswer in _readingTaskQuestionAnswerRepository.Where(x=>x.VisitTaskId==inDto.VisitTaskId) on data.Id equals questionAnswer.ReadingQuestionTrialId into questionAnswerTemp from leftquestionAnswer in questionAnswerTemp.DefaultIfEmpty() select new GetTrialReadingQuestionOutDto() @@ -319,29 +319,29 @@ namespace IRaCIS.Application.Services var qusetionList =await query.OrderBy(x=>x.ShowOrder).ToListAsync(); - //var groupList = qusetionList.Where(x => x.Type == "group").ToList(); - - //groupList.ForEach(x => - //{ - // x.Childrens = qusetionList.Where(y => y.GroupName == x.GroupName && y.ParentId == null).ToList(); - - // x.Childrens.ForEach(z => - // { - // this.FindChildQuestion(z, qusetionList); - // }); - - //}); - - - - List groupList = qusetionList.Where(x => x.ParentId == null).ToList(); - - + var groupList = qusetionList.Where(x => x.Type == "group").ToList(); groupList.ForEach(x => { - this.FindChildQuestion(x, qusetionList); + x.Childrens = qusetionList.Where(y => y.GroupName == x.GroupName && y.ParentId == null).ToList(); + + x.Childrens.ForEach(z => + { + this.FindChildQuestion(z, qusetionList); + }); + }); + + + + //List groupList = qusetionList.Where(x => x.ParentId == null).ToList(); + + + + //groupList.ForEach(x => + //{ + // this.FindChildQuestion(x, qusetionList); + //}); return (groupList, new { readingTaskState = readingTaskState