private async Task <LearnerDetailForExternalApi> GetLearnerDetails(GetBatchLearnerRequest request, StandardCollation standard)
        {
            LearnerDetailForExternalApi learnerDetail = null;

            if (standard != null)
            {
                var learner = await _ilrRepository.Get(request.Uln, standard.StandardId.GetValueOrDefault());

                if (learner != null)
                {
                    var epao = await _organisationRepository.GetByUkPrn(learner.UkPrn);

                    learnerDetail = new LearnerDetailForExternalApi()
                    {
                        Uln                            = learner.Uln,
                        GivenNames                     = learner.GivenNames,
                        FamilyName                     = learner.FamilyName,
                        LearnerStartDate               = learner.LearnStartDate,
                        LearnerReferenceNumber         = learner.LearnRefNumber,
                        PlannedEndDate                 = learner.PlannedEndDate,
                        CompletionStatus               = learner.CompletionStatus,
                        Standard                       = standard,
                        EndPointAssessorOrganisationId = epao?.EndPointAssessorOrganisationId ?? learner.EpaOrgId,
                        UkPrn                          = epao?.EndPointAssessorUkprn ?? learner.UkPrn,
                        OrganisationName               = epao?.EndPointAssessorName ?? "Unknown"
                    };
                }
                else
                {
                    _logger.LogError($"Could not find learner for ULN {request.Uln} and StandardCode {standard.StandardId.GetValueOrDefault()}");
                }
            }

            return(learnerDetail);
        }
Exemplo n.º 2
0
        private async Task <LearnerDetailForExternalApi> GetLearnerDetails(GetBatchLearnerRequest request, Standard standard, Certificate certFromRepository)
        {
            LearnerDetailForExternalApi learnerDetail = null;

            var certData = GetCertificateDataFromCertificate(certFromRepository);

            if (standard != null)
            {
                var learner = await _learnerRepository.Get(request.Uln, standard.LarsCode);

                if (learner != null)
                {
                    var epao = await _organisationRepository.GetByUkPrn(learner.UkPrn);

                    learnerDetail = new LearnerDetailForExternalApi()
                    {
                        Uln                            = learner.Uln,
                        GivenNames                     = learner.GivenNames,
                        FamilyName                     = learner.FamilyName,
                        LearnerStartDate               = learner.LearnStartDate,
                        LearnerReferenceNumber         = learner.LearnRefNumber,
                        PlannedEndDate                 = learner.PlannedEndDate,
                        CompletionStatus               = learner.CompletionStatus,
                        Standard                       = standard,
                        EndPointAssessorOrganisationId = epao?.EndPointAssessorOrganisationId ?? learner.EpaOrgId,
                        UkPrn                          = epao?.EndPointAssessorUkprn ?? learner.UkPrn,
                        OrganisationName               = epao?.EndPointAssessorName ?? "Unknown",
                        Version                        = certData?.Version,
                        CourseOption                   = certData?.CourseOption
                    };
                }
                else
                {
                    _logger.LogError($"Could not find learner for ULN {request.Uln} and StandardCode {standard.LarsCode}");
                }
            }

            return(learnerDetail);
        }