diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs index 2e58c9ef..093401f9 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs @@ -125,7 +125,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate TableQuestionId = x.TableQuestionId, TrialId = x.TrialId, VisitTaskId = visitTaskId, - }); + }).ToList(); try @@ -148,18 +148,20 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate var maxNewLesionsRowIndex = tableRowAnswers.Where(x => x.QuestionId == newLesionQuestion.Id).OrderByDescending(x => x.RowIndex).Select(x => x.RowIndex).FirstOrDefault(); maxNewLesionsRowIndex = Math.Floor(maxNewLesionsRowIndex); + + foreach (var item in tableRowAnswers.Where(x => x.QuestionId == newLesionQuestion.Id).OrderBy(x=>x.RowIndex)) { maxNewLesionsRowIndex++; item.QuestionId = alwaysNewLesionsQuestion.Id; item.RowIndex = maxNewLesionsRowIndex; - foreach (var tableAnswer in tableAnswers.Where(y=>y.RowId== item.Id)) + foreach (var tableAnswer in tableAnswers.Where(y => y.RowId == item.Id)) { - tableAnswer.QuestionId= alwaysNewLesionsQuestion.Id; + tableAnswer.QuestionId = alwaysNewLesionsQuestion.Id; tableAnswer.TableQuestionId = alwaysTableQuestionIdDic[tableAnswer.TableQuestionId]; + tableAnswer.RowIndex = maxNewLesionsRowIndex; } - } }