Skip to content

Commit

Permalink
Merge pull request #829 from SkillsFundingAgency/develop
Browse files Browse the repository at this point in the history
merge develop into master (Release21.11)
  • Loading branch information
sajidmalik authored Oct 11, 2024
2 parents 601861c + 0399f7b commit 3e77697
Show file tree
Hide file tree
Showing 141 changed files with 5,584 additions and 451 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,12 @@ public async Task<bool> PrsGradeChangeRequestAsync(PrsGradeChangeRequest request
return await PostAsync<PrsGradeChangeRequest, bool>(requestUri, request);
}

public async Task<BulkProcessResponse> ProcessBulkRommsAsync(BulkProcessRequest model)
{
var requestUri = ApiConstants.ProcessBulkRommsUri;
return await PostAsync<BulkProcessRequest, BulkProcessResponse>(requestUri, model);
}

#endregion

#region IndustryPlacement
Expand Down Expand Up @@ -466,6 +472,12 @@ public async Task<AdminLearnerRecord> GetAdminLearnerRecordAsync(int pathwayId)
return await GetAsync<AdminLearnerRecord>(requestUri);
}

public Task<IList<int>> GetAllowedChangeAcademicYearsAsync(int learnerAcademicYear, int pathwayStartYear)
{
var requestUri = string.Format(ApiConstants.GetAllowedChangeAcademicYearsUri, learnerAcademicYear, pathwayStartYear);
return GetAsync<IList<int>>(requestUri);
}

public async Task<bool> ProcessChangeStartYearAsync(ReviewChangeStartYearRequest request)
{
return await PostAsync<ReviewChangeStartYearRequest, bool>(ApiConstants.ProcessChangeStartYearUri, request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public interface IResultsAndCertificationInternalApiClient
Task<FindPrsLearnerRecord> FindPrsLearnerRecordAsync(long aoUkprn, long? uln, int? profileId = null);
Task<bool> PrsActivityAsync(PrsActivityRequest request);
Task<bool> PrsGradeChangeRequestAsync(PrsGradeChangeRequest request);
Task<BulkProcessResponse> ProcessBulkRommsAsync(BulkProcessRequest model);

#region IndustryPlacement
Task<IList<IpLookupData>> GetIpLookupDataAsync(IpLookupType ipLookupType, int? pathwayId = null);
Expand Down Expand Up @@ -129,6 +130,8 @@ public interface IResultsAndCertificationInternalApiClient

Task<PagedResponse<AdminSearchLearnerDetail>> GetAdminSearchLearnerDetailsAsync(AdminSearchLearnerRequest request);

Task<IList<int>> GetAllowedChangeAcademicYearsAsync(int learnerAcademicYear, int pathwayStartYear);

Task<bool> ProcessChangeStartYearAsync(ReviewChangeStartYearRequest request);

Task<bool> ProcessChangeIndustryPlacementAsync(ReviewChangeIndustryPlacementRequest request);
Expand Down
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 System.Collections.Generic;
using System.Threading.Tasks;

namespace Sfa.Tl.ResultsAndCertification.Application.Interfaces
Expand All @@ -12,6 +13,8 @@ public interface IAdminDashboardService

Task<AdminLearnerRecord> GetAdminLearnerRecordAsync(int registrationPathwayId);

Task<IList<int>> GetAllowedChangeAcademicYearsAsync(int learnerAcademicYear, int pathwayStartYear);

Task<bool> ProcessChangeStartYearAsync(ReviewChangeStartYearRequest request);

Task<bool> ProcessChangeIndustryPlacementAsync(ReviewChangeIndustryPlacementRequest request);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Sfa.Tl.ResultsAndCertification.Common.Enum;
using Sfa.Tl.ResultsAndCertification.Models.Contracts;
using Sfa.Tl.ResultsAndCertification.Models.Contracts.Common;
using Sfa.Tl.ResultsAndCertification.Models.Contracts.Learner;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
Expand All @@ -11,6 +12,8 @@ public interface ICommonService
{
Task<IEnumerable<LookupData>> GetLookupDataAsync(LookupCategory lookupCategory);

Task<IEnumerable<LookupData>> GetLookupDataAsync(LookupCategory lookupCategory, List<string> codoes);

Task<LoggedInUserTypeInfo> GetLoggedInUserTypeInfoAsync(long ukprn);

// FunctionLog
Expand All @@ -24,6 +27,8 @@ public interface ICommonService

Task<IEnumerable<AcademicYear>> GetAcademicYearsAsync();

Task<IEnumerable<Assessment>> GetAssessmentSeriesAsync();

bool IsIndustryPlacementTriggerDateValid();

DateTime CurrentDate { get; }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Sfa.Tl.ResultsAndCertification.Domain.Models;
using Sfa.Tl.ResultsAndCertification.Models.PostResultsService;
using Sfa.Tl.ResultsAndCertification.Models.PostResultsService.BulkProcess;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Sfa.Tl.ResultsAndCertification.Application.Interfaces
{
public interface IRommService
{
Task<IList<RommsRecordResponse>> ValidateRommTlevelsAsync(long aoUkprn, IEnumerable<RommCsvRecordResponse> withdrawalsData);

Task<RommsProcessResponse> ProcessRommsAsync(long AoUkprn, IList<TqRegistrationProfile> registrations, IEnumerable<RommsRecordResponse> rommData, string performedBy);

IList<TqRegistrationProfile> TransformRommModel(IList<RommsRecordResponse> withdrawalsData, string performedBy);

Task<IList<RommsRecordResponse>> ValidateRommLearnersAsync(long aoUkprn, IEnumerable<RommCsvRecordResponse> validRommsData);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public AdminDashboardLearnerMapper()
.ForMember(d => d.IsPendingWithdrawl, opts => opts.MapFrom(s => s.IsPendingWithdrawal))
.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.OverallCalculationStatus, opts => opts.MapFrom(s => GetOverallCalculationStatus(s.OverallResults)))
.ForMember(d => d.OverallResult, opts => opts.MapFrom(s => GetOverallResult(s.OverallResults)));

CreateMap<TlAwardingOrganisation, AwardingOrganisation>()
.ForMember(d => d.Id, opts => opts.MapFrom(s => s.Id))
Expand All @@ -42,5 +43,16 @@ public AdminDashboardLearnerMapper()
OverallResult overallResult = overallResults.First();
return overallResult.CalculationStatus;
}

private string GetOverallResult(ICollection<OverallResult> overallResults)
{
if (overallResults.IsNullOrEmpty())
{
return null;
}

OverallResult overallResult = overallResults.First();
return overallResult.ResultAwarded;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ public async Task<AdminLearnerRecord> GetAdminLearnerRecordAsync(int registratio
return _mapper.Map<AdminLearnerRecord>(tqRegistrationPathway);
}

public Task<IList<int>> GetAllowedChangeAcademicYearsAsync(int learnerAcademicYear, int pathwayStartYear)
=> _adminDashboardRepository.GetAllowedChangeAcademicYearsAsync(() => DateTime.Today, learnerAcademicYear, pathwayStartYear);

public async Task<bool> ProcessChangeStartYearAsync(ReviewChangeStartYearRequest request)
{
var tqRegistrationPathwayRepository = _repositoryFactory.GetRepository<TqRegistrationPathway>();
Expand Down Expand Up @@ -386,6 +389,7 @@ public async Task<bool> ProcessAdminChangePathwayResultAsync(ChangePathwayResult
pathwayResult.EndDate = utcNow;
pathwayResult.IsOptedin = false;

PrsStatus prstatus = GetPrsStatus(pathwayResult.PrsStatus);

var updated = await pathwayResultRepo.UpdateWithSpecifedColumnsOnlyAsync(pathwayResult, u => u.ModifiedBy, u => u.ModifiedOn, u => u.EndDate, u => u.IsOptedin) > 0;

Expand All @@ -400,6 +404,7 @@ public async Task<bool> ProcessAdminChangePathwayResultAsync(ChangePathwayResult
IsBulkUpload = false,
CreatedBy = request.CreatedBy,
EndDate = hasEnddate ? utcNow : null,
PrsStatus = prstatus

};

Expand Down Expand Up @@ -434,6 +439,8 @@ public async Task<bool> ProcessAdminChangeSpecialismResultAsync(ChangeSpecialism
specialismResult.EndDate = utcNow;
specialismResult.IsOptedin = false;

PrsStatus prstatus = GetPrsStatus(specialismResult.PrsStatus);

var updated = await specialismResultRepo.UpdateWithSpecifedColumnsOnlyAsync(specialismResult, u => u.ModifiedBy, u => u.ModifiedOn, u => u.EndDate, u => u.IsOptedin) > 0;

if (request.SelectedGradeId > 0)
Expand All @@ -447,7 +454,7 @@ public async Task<bool> ProcessAdminChangeSpecialismResultAsync(ChangeSpecialism
IsBulkUpload = false,
CreatedBy = request.CreatedBy,
EndDate = hasEnddate ? utcNow : null,

PrsStatus = prstatus
};

bool created = await specialismResultRepo.CreateAsync(createSpecialsimResult) > 0;
Expand Down Expand Up @@ -483,5 +490,7 @@ private ChangeLog CreateChangeLog(ReviewChangeRequest request, object details)

return changeLog;
}

private static PrsStatus GetPrsStatus(PrsStatus? prsStatus) => prsStatus != PrsStatus.Final ? default : PrsStatus.Final;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Sfa.Tl.ResultsAndCertification.Models.Configuration;
using Sfa.Tl.ResultsAndCertification.Models.Contracts;
using Sfa.Tl.ResultsAndCertification.Models.Contracts.Common;
using Sfa.Tl.ResultsAndCertification.Models.Contracts.Learner;
using System;
using System.Collections.Generic;
using System.Linq;
Expand All @@ -29,10 +30,12 @@ public class CommonService : ICommonService

public DateTime CurrentDate => DateTime.UtcNow.Date;

public CommonService(ILogger<CommonService> logger, IMapper mapper,
public CommonService(ILogger<CommonService> logger,
IMapper mapper,
IRepository<TlLookup> tlLookupRepository,
IRepository<FunctionLog> functionLogRepository,
ICommonRepository commonRepository, INotificationService notificationService,
ICommonRepository commonRepository,
INotificationService notificationService,
ResultsAndCertificationConfiguration configuration,
IRepository<ChangeLog> changeLogRepository)
{
Expand All @@ -53,6 +56,18 @@ public async Task<IEnumerable<LookupData>> GetLookupDataAsync(LookupCategory loo
return _mapper.Map<IEnumerable<LookupData>>(lookupData);
}

public async Task<IEnumerable<LookupData>> GetLookupDataAsync(LookupCategory lookupCategory, List<string> codes)
{
var lookupData = await _tlLookupRepository.GetManyAsync(x => x.IsActive && x.Category == lookupCategory.ToString())
.OrderBy(x => x.SortOrder)
.ToListAsync();


var filteredLookups = lookupData.ExceptBy(codes, e => e.Code).ToList();

return _mapper.Map<IEnumerable<LookupData>>(filteredLookups);
}

public async Task<bool> CreateFunctionLog(FunctionLogDetails model)
{
if (model != null)
Expand Down Expand Up @@ -135,5 +150,9 @@ public bool IsIndustryPlacementTriggerDateValid()
{
return await _commonRepository.GetAcademicYearsAsync();
}

public async Task<IEnumerable<Assessment>> GetAssessmentSeriesAsync()
=> await _commonRepository.GetAssessmentSeriesAsync();

}
}
Loading

0 comments on commit 3e77697

Please sign in to comment.