public async Task <List <SupplementaryInformation> > GetSupplementaryInformation(Guid applicationId, string pageId) { var supplementaryInformation = new List <SupplementaryInformation>(); if (pageId == RoatpWorkflowPageIds.SafeguardingPolicyIncludesPreventDutyPolicy) { const int safegaurdingPolicySequenceNumber = RoatpWorkflowSequenceIds.ProtectingYourApprentices; const int safegaurdingPolicySectionNumber = 4; var page = await _assessorApiClient.GetAssessorPage(applicationId, safegaurdingPolicySequenceNumber, safegaurdingPolicySectionNumber, pageId); var answer = page?.Answers.First().Value; // Only retrieve if it was included in the safeguarding policy if ("Yes".Equals(answer, StringComparison.InvariantCultureIgnoreCase)) { var safeGuardingPolicySupplementaryInformation = await GetSafeguardingPolicySupplementaryInformation(applicationId); if (safeGuardingPolicySupplementaryInformation != null) { supplementaryInformation.Add(safeGuardingPolicySupplementaryInformation); } } } return(supplementaryInformation); }
public async Task <AssessorReviewAnswersViewModel> GetReviewAnswersViewModel(GetReviewAnswersRequest request) { var application = await _applicationApiClient.GetApplication(request.ApplicationId); var contact = await _applicationApiClient.GetContactForApplication(request.ApplicationId); var assessorPage = await _assessorApiClient.GetAssessorPage(request.ApplicationId, request.SequenceNumber, request.SectionNumber, request.PageId); if (application is null || contact is null || assessorPage is null) { return(null); } var viewModel = new AssessorReviewAnswersViewModel { ApplicationId = application.ApplicationId, Ukprn = application.ApplyData.ApplyDetails.UKPRN, ApplyLegalName = application.ApplyData.ApplyDetails.OrganisationName, ApplicationRoute = application.ApplyData.ApplyDetails.ProviderRouteName, SubmittedDate = application.ApplyData.ApplyDetails.ApplicationSubmittedOn, ApplicantEmailAddress = contact.Email, SequenceNumber = assessorPage.SequenceNumber, SectionNumber = assessorPage.SectionNumber, PageId = assessorPage.PageId, NextPageId = assessorPage.NextPageId, Caption = assessorPage.Caption, Heading = assessorPage.Heading, GuidanceInformation = assessorPage.GuidanceInformation != null ? new List <string>(assessorPage.GuidanceInformation) : new List <string>(), Questions = assessorPage.Questions != null ? new List <Question>(assessorPage.Questions) : new List <Question>(), Answers = assessorPage.Answers != null ? new List <Answer>(assessorPage.Answers) : new List <Answer>(), TabularData = GetTabularDataFromQuestionsAndAnswers(assessorPage.Questions, assessorPage.Answers), SupplementaryInformation = await _supplementaryInformationService.GetSupplementaryInformation(application.ApplicationId, assessorPage.PageId) }; await SetPageReviewOutcome(request, viewModel); return(viewModel); }