Skip to content

Commit

Permalink
Release 22.1 (#852) (#853)
Browse files Browse the repository at this point in the history
* Texts updated (#832)

* Request new document (#833)

* Feature/tl2023 758 result slip solution in dotnet (#835)

* Feature/tl2023 769 admin certificate (#836)

* Request new document

* Allow SoA replacement requests and display date of last request

* Fix dodgy merge

* Feature/tl2023 790 results slip solution in dotnet aspose licence (#838)

* ability to use Aspose licence

* Remove function app config

* unit tests and code improvements

---------




* Feature/tl2023 744 reinstated certificates (#840)

* Changes

* Reinstate certificates

* Feature/tl2023 758 result slip solution in dotnet (#839)

* Fix (#841)

* update aspose version to latest

* updated config

* update Aspose version to 24.5.1

* Feature/tl2023 786 tile (#846)

* Add tile

* Remove link

* SoA replacement button back (#847)

* Text updated (#848)

* Remove academic years to process (#849)

* Remove academic years to process

* Rename

* Remove loader and refactor (#851)

---------

Co-authored-by: Sajid Shafique Malik <[email protected]>
Co-authored-by: Sam Hiscox <[email protected]>
Co-authored-by: Sam H <[email protected]>
  • Loading branch information
4 people authored Nov 14, 2024
1 parent 97a4375 commit 6d5f851
Show file tree
Hide file tree
Showing 182 changed files with 3,214 additions and 614 deletions.
8 changes: 4 additions & 4 deletions azure/tlevels-environment.json
Original file line number Diff line number Diff line change
Expand Up @@ -631,13 +631,13 @@
"name": "WEBSITE_SWAP_WARMUP_PING_PATH",
"value": "/api/healthcheck"
},
{
"name": "WEBSITE_SWAP_WARMUP_PING_STATUSES",
"value": "200"
},
{
"name": "WEBSITE_ADD_SITENAME_BINDINGS_IN_APPHOST_CONFIG",
"value": "1"
},
{
"name": "WEBSITE_SWAP_WARMUP_PING_STATUSES",
"value": "200"
}
]
},
Expand Down
8 changes: 0 additions & 8 deletions config/Sfa.Tl.ResultsAndCertification.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -448,10 +448,6 @@
},
"AnalystOverallResultExtractSettings": {
"properties": {
"AcademicYearsToProcess": {
"type": "array",
"environmentVariable": "AcademicYearsToProcess"
},
"ValidDateRanges": {
"type": "array",
"environmentVariable": "AnalystOverallValidDateRanges"
Expand All @@ -463,10 +459,6 @@
},
"AnalystCoreResultExtractSettings": {
"properties": {
"CoreAcademicYearsToProcess": {
"type": "array",
"environmentVariable": "CoreAcademicYearsToProcess"
},
"CoreValidDateRanges": {
"type": "array",
"environmentVariable": "AnalystCoreValidDateRanges"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,13 @@ public async Task<IList<AssessmentSeriesDetails>> GetAssessmentSeriesAsync()
return await GetAsync<IList<AssessmentSeriesDetails>>(requestUri);
}

// Assessment Series
public async Task<AssessmentSeriesDetails> GetResultCalculationAssessmentAsync()
{
var requestUri = ApiConstants.GetResultCalculationAssessmentUri;
return await GetAsync<AssessmentSeriesDetails>(requestUri);
}

// Results endpoints
public async Task<BulkResultResponse> ProcessBulkResultsAsync(BulkProcessRequest model)
{
Expand Down Expand Up @@ -426,6 +433,18 @@ public async Task<DataExportResponse> DownloadOverallResultsDataAsync(long provi
return await GetAsync<DataExportResponse>(requestUri);
}

public async Task<DataExportResponse> DownloadOverallResultSlipsDataAsync(long providerUkprn, string requestedBy)
{
var requestUri = string.Format(ApiConstants.DownloadOverallResultSlipsDataUri, providerUkprn, requestedBy);
return await GetAsync<DataExportResponse>(requestUri);
}

public async Task<DataExportResponse> DownloadLearnerOverallResultSlipsDataAsync(long providerUkprn, int profileId, string requestedBy)
{
var requestUri = string.Format(ApiConstants.DownloadLearnerOverallResultSlipsDataUri, providerUkprn, profileId, requestedBy);
return await GetAsync<DataExportResponse>(requestUri);
}

#region Industry Placement Bulk Upload

public async Task<BulkIndustryPlacementResponse> ProcessBulkIndustryPlacementsAsync(BulkProcessRequest model)
Expand Down Expand Up @@ -583,6 +602,13 @@ public Task<DataExportResponse> GetProviderRegistrationsAsync(GetProviderRegistr

#endregion

#region Request replacement document

public Task<bool> ProcessAdminCreateReplacementDocumentPrintingRequestAsync(ReplacementPrintRequest request)
=> PostAsync<ReplacementPrintRequest, bool>(ApiConstants.ProcessAdminCreateReplacementDocumentPrintingRequestUri, request);

#endregion

#region Private Methods

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ public interface IResultsAndCertificationInternalApiClient
Task<bool> RemoveAssessmentEntryAsync(RemoveAssessmentEntryRequest model);
Task<IList<AssessmentSeriesDetails>> GetAssessmentSeriesAsync();

// Assessment Series
Task<AssessmentSeriesDetails> GetResultCalculationAssessmentAsync();

// Results
Task<BulkResultResponse> ProcessBulkResultsAsync(BulkProcessRequest model);
Task<ResultDetails> GetResultDetailsAsync(long aoUkprn, int profileId, RegistrationPathwayStatus? status = null);
Expand Down Expand Up @@ -114,6 +117,8 @@ public interface IResultsAndCertificationInternalApiClient

Task<IList<DataExportResponse>> GenerateDataExportAsync(long aoUkprn, DataExportType dataExportType, string requestedBy);
Task<DataExportResponse> DownloadOverallResultsDataAsync(long providerUkprn, string requestedBy);
Task<DataExportResponse> DownloadOverallResultSlipsDataAsync(long providerUkprn, string requestedBy);
Task<DataExportResponse> DownloadLearnerOverallResultSlipsDataAsync(long providerUkprn, int profileId, string requestedBy);

// Industry Placement Bulk Upload
Task<BulkIndustryPlacementResponse> ProcessBulkIndustryPlacementsAsync(BulkProcessRequest model);
Expand Down Expand Up @@ -197,5 +202,11 @@ public interface IResultsAndCertificationInternalApiClient
Task<DataExportResponse> GetProviderRegistrationsAsync(GetProviderRegistrationsRequest request);

#endregion

#region Request replacement document

Task<bool> ProcessAdminCreateReplacementDocumentPrintingRequestAsync(ReplacementPrintRequest request);

#endregion
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Sfa.Tl.ResultsAndCertification.Models.Contracts.AdminDashboard;
using Sfa.Tl.ResultsAndCertification.Models.Contracts.Common;
using Sfa.Tl.ResultsAndCertification.Models.Contracts.TrainingProvider;
using System.Collections.Generic;
using System.Threading.Tasks;

Expand Down Expand Up @@ -34,5 +35,7 @@ public interface IAdminDashboardService
Task<bool> ProcessAdminChangePathwayResultAsync(ChangePathwayResultRequest request);

Task<bool> ProcessAdminChangeSpecialismResultAsync(ChangeSpecialismResultRequest request);

Task<bool> CreateReplacementDocumentPrintingRequestAsync(ReplacementPrintRequest request);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ public interface IOverallResultCalculationService
Task<List<OverallResultResponse>> CalculateOverallResultsAsync(DateTime runDate);
Task<bool> SaveOverallResultsAsync(IList<OverallResult> overallResults);
Task<IList<DownloadOverallResultsData>> DownloadOverallResultsDataAsync(long providerUkprn);
Task<IList<DownloadOverallResultSlipsData>> DownloadOverallResultSlipsDataAsync(long providerUkprn);
Task<DownloadOverallResultSlipsData> DownloadLearnerOverallResultSlipsDataAsync(long providerUkprn, long profileId);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Sfa.Tl.ResultsAndCertification.Models.DownloadOverallResults;
using System.Collections.Generic;

namespace Sfa.Tl.ResultsAndCertification.Application.Interfaces
{
public interface IResultSlipsGeneratorService
{
byte[] GetByteData(IEnumerable<DownloadOverallResultSlipsData> data);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using Sfa.Tl.ResultsAndCertification.Common.Extensions;
using Sfa.Tl.ResultsAndCertification.Domain.Models;
using Sfa.Tl.ResultsAndCertification.Models.Contracts.AdminDashboard;
using Sfa.Tl.ResultsAndCertification.Models.Contracts.ProviderAddress;
using System;
using System.Collections.Generic;
using System.Linq;

Expand All @@ -24,7 +26,11 @@ public AdminDashboardLearnerMapper()
.ForMember(d => d.Pathway, opts => opts.MapFrom(s => s))
.ForMember(d => d.AwardingOrganisation, opts => opts.MapFrom(s => s.TqProvider.TqAwardingOrganisation.TlAwardingOrganisaton))
.ForMember(d => d.OverallCalculationStatus, opts => opts.MapFrom(s => GetOverallCalculationStatus(s.OverallResults)))
.ForMember(d => d.OverallResult, opts => opts.MapFrom(s => GetOverallResult(s.OverallResults)));
.ForMember(d => d.OverallResult, opts => opts.MapFrom(s => GetOverallResult(s.OverallResults)))
.ForMember(d => d.PrintCertificateId, opts => opts.MapFrom(s => GetPrintCertificateId(s.PrintCertificates)))
.ForMember(d => d.PrintCertificateType, opts => opts.MapFrom(s => GetPrintCertificateType(s.PrintCertificates)))
.ForMember(d => d.LastPrintCertificateRequestedDate, opts => opts.MapFrom(s => GetLastPrintCertificateRequestedDate(s.PrintCertificates)))
.ForMember(d => d.ProviderAddress, opts => opts.MapFrom(s => GetProviderAddress(s.TqProvider.TlProvider.TlProviderAddresses)));

CreateMap<TlAwardingOrganisation, AwardingOrganisation>()
.ForMember(d => d.Id, opts => opts.MapFrom(s => s.Id))
Expand All @@ -33,7 +39,7 @@ public AdminDashboardLearnerMapper()
.ForMember(d => d.DisplayName, opts => opts.MapFrom(s => s.DisplayName));
}

private CalculationStatus? GetOverallCalculationStatus(ICollection<OverallResult> overallResults)
private static CalculationStatus? GetOverallCalculationStatus(ICollection<OverallResult> overallResults)
{
if (overallResults.IsNullOrEmpty())
{
Expand All @@ -44,7 +50,7 @@ public AdminDashboardLearnerMapper()
return overallResult.CalculationStatus;
}

private string GetOverallResult(ICollection<OverallResult> overallResults)
private static string GetOverallResult(ICollection<OverallResult> overallResults)
{
if (overallResults.IsNullOrEmpty())
{
Expand All @@ -54,5 +60,40 @@ private string GetOverallResult(ICollection<OverallResult> overallResults)
OverallResult overallResult = overallResults.First();
return overallResult.ResultAwarded;
}

private static T GetPrintCertificateProperty<T>(ICollection<PrintCertificate> printCertificates, Func<PrintCertificate, T> getProperty)
{
PrintCertificate printCertificate = printCertificates.OrderByDescending(c => c.Id).FirstOrDefault();
return getProperty(printCertificate);
}

private static int? GetPrintCertificateId(ICollection<PrintCertificate> printCertificates)
=> GetPrintCertificateProperty(printCertificates, p => p?.Id);

private static PrintCertificateType? GetPrintCertificateType(ICollection<PrintCertificate> printCertificates)
=> GetPrintCertificateProperty(printCertificates, p => p?.Type);

private static DateTime? GetLastPrintCertificateRequestedDate(ICollection<PrintCertificate> printCertificates)
=> GetPrintCertificateProperty(printCertificates, p => p?.LastRequestedOn);

private static Address GetProviderAddress(ICollection<TlProviderAddress> addresses)
{
if (addresses.IsNullOrEmpty())
return null;

return addresses
.OrderByDescending(addr => addr.CreatedOn)
.Select(addr => new Address
{
AddressId = addr.Id,
DepartmentName = addr.DepartmentName,
OrganisationName = addr.OrganisationName,
AddressLine1 = addr.AddressLine1,
AddressLine2 = addr.AddressLine2,
Town = addr.Town,
Postcode = addr.Postcode
})
.First();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public AssessmentMapper()
.ForMember(d => d.Year, opts => opts.MapFrom(s => s.Year))
.ForMember(d => d.StartDate, opts => opts.MapFrom(s => s.StartDate))
.ForMember(d => d.EndDate, opts => opts.MapFrom(s => s.EndDate))
.ForMember(d => d.ResultPublishDate, opts => opts.MapFrom(s => s.ResultPublishDate))
.ForMember(d => d.AppealEndDate, opts => opts.MapFrom(s => s.AppealEndDate));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public CertificateMapper()
.ForMember(d => d.DisplaySnapshot, opts => opts.Ignore())
.ForMember(d => d.LearningDetails, opts => opts.MapFrom(s => TransformLearningDetails(s)))
.ForMember(d => d.CreatedBy, opts => opts.MapFrom(s => Constants.FunctionPerformedBy))
.ForMember(d => d.TqRegistrationPathway, opts => opts.Ignore());
.ForMember(d => d.TqRegistrationPathway, opts => opts.Ignore())
.ForMember(d => d.LastRequestedOn, opts => opts.MapFrom(s => DateTime.UtcNow));
}

private static string TransformLearningDetails(OverallResult overallResult)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using AutoMapper;
using Sfa.Tl.ResultsAndCertification.Common.Extensions;
using Sfa.Tl.ResultsAndCertification.Domain.Models;
using System.Collections.Generic;
using System.Linq;

namespace Sfa.Tl.ResultsAndCertification.Application.Mappers.Converter.Specialism
{
public class SpecialismNameConverterNoDoubleQuotes : SpecialismConverterBase, IValueConverter<IEnumerable<TqRegistrationSpecialism>, string>
{
public string Convert(IEnumerable<TqRegistrationSpecialism> sourceMember, ResolutionContext context)
{
if (sourceMember.IsNullOrEmpty())
{
return string.Empty;
}

string specialismName = sourceMember.Count() switch
{
1 => GetSingleSpecialismProperty(sourceMember, rs => rs.TlSpecialism.Name),
2 => GetDualSpecialismProperty(sourceMember, ds => ds.Name),
_ => string.Empty
};

return specialismName;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ public OverallResultCalculationMapper()
.ForMember(d => d.SpecialismComponent, opts => opts.ConvertUsing(new SpecialismNameConverter(), s => s.TqRegistrationPathway.TqRegistrationSpecialisms.Where(w => w.EndDate == null)))
.ForMember(d => d.SpecialismCode, opts => opts.ConvertUsing(new SpecialismCodeConverter(), s => s.TqRegistrationPathway.TqRegistrationSpecialisms.Where(w => w.EndDate == null)))
.ForMember(d => d.SpecialismResult, opts => opts.MapFrom(s => s.SpecialismResultAwarded));

CreateMap<OverallResult, DownloadOverallResultSlipsData>()
.ForMember(d => d.Uln, opts => opts.MapFrom(s => s.TqRegistrationPathway.TqRegistrationProfile.UniqueLearnerNumber))
.ForMember(d => d.LearnerName, opts => opts.MapFrom(s => $"{s.TqRegistrationPathway.TqRegistrationProfile.Firstname} {s.TqRegistrationPathway.TqRegistrationProfile.Lastname}"))
.ForMember(d => d.ProviderName, opts => opts.MapFrom(s => s.TqRegistrationPathway.TqProvider.TlProvider.Name))
.ForMember(d => d.ProviderUkprn, opts => opts.MapFrom(s => s.TqRegistrationPathway.TqProvider.TlProvider.UkPrn))
.ForMember(d => d.CoreAssessmentSeries, opts => opts.MapFrom(s => s.TqRegistrationPathway.TqPathwayAssessments.Where(a => a.IsOptedin && a.EndDate == null).FirstOrDefault().AssessmentSeries.Name))
.ForMember(d => d.SpecialismAssessmentSeries, opts => opts.MapFrom(s => s.TqRegistrationPathway.TqRegistrationSpecialisms.FirstOrDefault(r => r.IsOptedin && r.EndDate == null).TqSpecialismAssessments.FirstOrDefault(a => a.IsOptedin && a.EndDate == null).AssessmentSeries.Name))
.ForMember(d => d.OverallResult, opts => opts.MapFrom(s => s.ResultAwarded))
.ForMember(d => d.Details, opts => opts.MapFrom(s => JsonConvert.DeserializeObject<OverallResultDetail>(s.Details)))
.ForMember(d => d.SpecialismComponent, opts => opts.ConvertUsing(new SpecialismNameConverterNoDoubleQuotes(), s => s.TqRegistrationPathway.TqRegistrationSpecialisms.Where(w => w.EndDate == null)))
.ForMember(d => d.SpecialismCode, opts => opts.ConvertUsing(new SpecialismCodeConverter(), s => s.TqRegistrationPathway.TqRegistrationSpecialisms.Where(w => w.EndDate == null)))
.ForMember(d => d.SpecialismResult, opts => opts.MapFrom(s => s.SpecialismResultAwarded));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Sfa.Tl.ResultsAndCertification.Common.Enum;
using Sfa.Tl.ResultsAndCertification.Domain.Models;
using Sfa.Tl.ResultsAndCertification.Models.Contracts.StatementOfAchievement;
using System;
using System.Collections.Generic;

namespace Sfa.Tl.ResultsAndCertification.Application.Mappers
Expand All @@ -22,7 +23,7 @@ public StatementOfAchievementMapper()
{
return new List<PrintBatchItem>
{
new PrintBatchItem
new()
{
TlProviderAddressId = m.AddressId,
CreatedBy = m.PerformedBy,
Expand All @@ -36,15 +37,16 @@ public StatementOfAchievementMapper()
{
return new List<PrintCertificate>
{
new PrintCertificate
new()
{
Uln = m.Uln,
LearnerName = m.LearnerName,
TqRegistrationPathwayId = m.RegistrationPathwayId,
Type = PrintCertificateType.StatementOfAchievement,
LearningDetails = JsonConvert.SerializeObject(m.LearningDetails),
DisplaySnapshot = JsonConvert.SerializeObject(m.SoaPrintingDetails),
CreatedBy = m.PerformedBy
CreatedBy = m.PerformedBy,
LastRequestedOn = DateTime.UtcNow
}
};
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using AutoMapper;
using Sfa.Tl.ResultsAndCertification.Common.Enum;
using Sfa.Tl.ResultsAndCertification.Domain.Models;
using System;
using System.Collections.Generic;

namespace Sfa.Tl.ResultsAndCertification.Application.Mappers
Expand All @@ -21,7 +22,7 @@ public TrainingProviderMapper()
{
return new List<PrintBatchItem>
{
new PrintBatchItem
new()
{
TlProviderAddressId = (int)context.Items["providerAddressId"],
CreatedBy = (string)context.Items["performedBy"],
Expand All @@ -35,7 +36,7 @@ public TrainingProviderMapper()
{
return new List<PrintCertificate>
{
new PrintCertificate
new()
{
Uln = m.Uln,
LearnerName = m.LearnerName,
Expand All @@ -44,7 +45,8 @@ public TrainingProviderMapper()
LearningDetails = m.LearningDetails,
DisplaySnapshot = m.DisplaySnapshot,
IsReprint = true,
CreatedBy = (string)context.Items["performedBy"]
CreatedBy = (string)context.Items["performedBy"],
LastRequestedOn = DateTime.UtcNow
}
};
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Aspose.Pdf;
using Aspose.Pdf.Text;

namespace Sfa.Tl.ResultsAndCertification.Application.Models.ResultSlips
{
public class DataRowStyle : IResultSlipRowStyle
{
public Color BackgroundColor => Color.White;
public TextState RowStyle
{
get
{
TextState textState = new TextState();
textState.FontSize = 11f;
return textState;
}
}
}


}
Loading

0 comments on commit 6d5f851

Please sign in to comment.