Skip to content

Commit

Permalink
Merge pull request #322 from SkillsFundingAgency/develop
Browse files Browse the repository at this point in the history
From develop to master
  • Loading branch information
mustafajawad786 authored Jun 26, 2023
2 parents 6763a31 + cb8c74a commit 6f28146
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
using Newtonsoft.Json;
using Sfa.Tl.ResultsAndCertification.Domain.Models;
using Sfa.Tl.ResultsAndCertification.Models.ExtractIndustryPlacement;
using Sfa.Tl.ResultsAndCertification.Models.OverallResults;
using System.Linq;

namespace Sfa.Tl.ResultsAndCertification.Application.Mappers
{
public class ExtractIndustryPlacementMapper : Profile
{
public ExtractIndustryPlacementMapper()
{
CreateMap<IndustryPlacement, ExtractData>()
.ForMember(d => d.Uln, opts => opts.MapFrom(s => s.TqRegistrationPathway.TqRegistrationProfile.UniqueLearnerNumber))
.ForMember(d => d.LastName, opts => opts.MapFrom(s => s.TqRegistrationPathway.TqRegistrationProfile.Lastname))
.ForMember(d => d.FirstName, opts => opts.MapFrom(s => s.TqRegistrationPathway.TqRegistrationProfile.Firstname))
.ForMember(d => d.UKPRN, opts => opts.MapFrom(s => s.TqRegistrationPathway.TqProvider.TlProvider.UkPrn))
.ForMember(d => d.ProviderName, opts => opts.MapFrom(s => s.TqRegistrationPathway.TqProvider.TlProvider.Name))
.ForMember(d => d.IndustryPlacementStatus, opts => opts.MapFrom(s => s.Status))
.ForMember(d => d.PendingWithdrawnFlag, opts => opts.MapFrom(s => s.TqRegistrationPathway.IsPendingWithdrawal.ToString()));
CreateMap<TqRegistrationPathway, ExtractData>()
.ForMember(d => d.Uln, opts => opts.MapFrom(s => s.TqRegistrationProfile.UniqueLearnerNumber))
.ForMember(d => d.LastName, opts => opts.MapFrom(s => s.TqRegistrationProfile.Lastname))
.ForMember(d => d.FirstName, opts => opts.MapFrom(s => s.TqRegistrationProfile.Firstname))
.ForMember(d => d.UKPRN, opts => opts.MapFrom(s => s.TqProvider.TlProvider.UkPrn))
.ForMember(d => d.ProviderName, opts => opts.MapFrom(s => s.TqProvider.TlProvider.Name.Replace(","," ")))
.ForMember(d => d.IndustryPlacementStatus, opts => opts.MapFrom(s => s.IndustryPlacements.Any() ? s.IndustryPlacements.First().Status.ToString() : "Null"))
.ForMember(d => d.PendingWithdrawnFlag, opts => opts.MapFrom(s => s.IsPendingWithdrawal.ToString()));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -376,21 +376,18 @@ public async Task<FunctionResponse> ProcessIndustryPlacementExtractionsAsync()
throw new ApplicationException($"Current Academic years are not found. Method: {nameof(ProcessIndustryPlacementExtractionsAsync)}");
}

// 1. Get data
var industryPlacements = await _industryPlacementRepository.GetManyAsync()
.Include(x => x.TqRegistrationPathway)
.ThenInclude(x => x.TqRegistrationProfile)
.Include(x => x.TqRegistrationPathway)
.ThenInclude(x => x.TqProvider)
.ThenInclude(x => x.TlProvider)
.Include(x => x.TqRegistrationPathway)
.ThenInclude(x => x.TqProvider)
.ThenInclude(x => x.TqAwardingOrganisation)
var industryPlacements = await _tqRegistrationPathwayRepository.GetManyAsync()
.Include(x => x.IndustryPlacements)
.Include(x => x.TqRegistrationProfile)
.Include(x => x.TqProvider)
.ThenInclude(x => x.TlProvider)
.Include(x => x.TqProvider)
.ThenInclude(x => x.TqAwardingOrganisation)
.ThenInclude(x => x.TlAwardingOrganisaton)
.Where(x => x.TqRegistrationPathway.Status == RegistrationPathwayStatus.Active &&
x.TqRegistrationPathway.EndDate == null &&
x.TqRegistrationPathway.AcademicYear == currentAcademicYears.FirstOrDefault().Year - 1)
.ToListAsync();
.Where(w => w.Status == RegistrationPathwayStatus.Active &&
w.EndDate == null &&
w.AcademicYear == currentAcademicYears.FirstOrDefault().Year - 1)
.ToListAsync();

var industryPlacementResults = _mapper.Map<IList<ExtractData>>(industryPlacements);

Expand All @@ -410,7 +407,6 @@ public async Task<FunctionResponse> ProcessIndustryPlacementExtractionsAsync()
throw new ApplicationException(message);
}

string result = System.Text.Encoding.UTF8.GetString(byteData);
var blobUniqueReference = Guid.NewGuid();

// 3. Write response to blob
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public CertificatePrinting(ResultsAndCertificationConfiguration configuration, I
_configuration = configuration;
_commonService = commonService;
_certificatePrintingService = certificatePrintingService;
}
}

[FunctionName(Constants.GenerateCertificatePrintingBatches)]
public async Task GenerateCertificatePrintingBatchesAsync([TimerTrigger("%CertificatePrintingBatchesCreateTrigger%")] TimerInfo timer, ExecutionContext context, ILogger logger)
Expand Down Expand Up @@ -79,7 +79,7 @@ public async Task GenerateCertificatePrintingBatchesAsync([TimerTrigger("%Certif
}
}
}

[FunctionName(Constants.FetchCertificatePrintingBatchSummary)]
public async Task FetchCertificatePrintingBatchSummaryAsync([TimerTrigger("%CertificatePrintingBatchSummaryTrigger%")] TimerInfo timer, ExecutionContext context, ILogger logger)
{
Expand Down Expand Up @@ -125,7 +125,7 @@ public async Task FetchCertificatePrintingBatchSummaryAsync([TimerTrigger("%Cert
await _commonService.SendFunctionJobFailedNotification(context.FunctionName, errorMessage);
}
}

[FunctionName(Constants.SubmitCertificatePrintingRequest)]
public async Task SubmitCertificatePrintingRequestAsync([TimerTrigger("%CertificatePrintingRequestTrigger%")] TimerInfo timer, ExecutionContext context, ILogger logger)
{
Expand Down Expand Up @@ -171,7 +171,7 @@ public async Task SubmitCertificatePrintingRequestAsync([TimerTrigger("%Certific
await _commonService.SendFunctionJobFailedNotification(context.FunctionName, errorMessage);
}
}

[FunctionName(Constants.FetchCertificatePrintingTrackBatch)]
public async Task FetchCertificatePrintingTrackBatchAsync([TimerTrigger("%CertificatePrintingTrackBatchTrigger%")] TimerInfo timer, ExecutionContext context, ILogger logger)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public LearnerGender(ICommonService commonService, ILrsLearnerService learnerSer
_commonService = commonService;
_learnerService = learnerService;
}

[FunctionName(Constants.FetchLearnerGender)]
public async Task FetchLearnerGenderAsync([TimerTrigger("%LearnerGenderTrigger%")]TimerInfo timer, ExecutionContext context, ILogger logger)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public LearnerVerificationAndLearningEvents(ICommonService commonService, ILrsPe
_commonService = commonService;
_personalLearningRecordService = personalLearningRecordService;
}

[FunctionName(Constants.VerifyLearnerAndFetchLearningEvents)]
public async Task VerifyLearnerAndFetchLearningEventsAsync([TimerTrigger("%LearnerVerificationAndLearningEventsTrigger%")]TimerInfo timer, ExecutionContext context, ILogger logger)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public OverallResultCalculation(ResultsAndCertificationConfiguration configurati
_overallResultCalculationService = overallResultCalculationService;
_commonService = commonService;
}

[FunctionName(Constants.OverallResultCalculation)]
public async Task OverallResultCalculationAsync([TimerTrigger("%OverallResultCalculationTrigger%")] TimerInfo timer, ExecutionContext context, ILogger logger)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public UcasDataTransfer(IUcasDataTransferService ucasDataTransferService, ICommo
_ucasDataTransferService = ucasDataTransferService;
_commonService = commonService;
}

[FunctionName(Constants.UcasTransferEntries)]
public async Task UcasTransferEntriesAsync([TimerTrigger("%UcasTransferEntriesTrigger%")] TimerInfo timer, ExecutionContext context, ILogger logger)
{
Expand Down Expand Up @@ -68,7 +68,7 @@ public async Task UcasTransferEntriesAsync([TimerTrigger("%UcasTransferEntriesTr
}
}
}

[FunctionName(Constants.UcasTransferResults)]
public async Task UcasTransferResultsAsync([TimerTrigger("%UcasTransferResultsTrigger%")] TimerInfo timer, ExecutionContext context, ILogger logger)
{
Expand Down Expand Up @@ -114,7 +114,7 @@ public async Task UcasTransferResultsAsync([TimerTrigger("%UcasTransferResultsTr
}
}
}

[FunctionName(Constants.UcasTransferAmendments)]
public async Task UcasTransferAmendmentsAsync([TimerTrigger("%UcasTransferAmendmentsTrigger%")] TimerInfo timer, ExecutionContext context, ILogger logger)
{
Expand Down

0 comments on commit 6f28146

Please sign in to comment.