Skip to content

Commit

Permalink
Included region and local authority
Browse files Browse the repository at this point in the history
  • Loading branch information
mshakirdfe committed Aug 15, 2024
1 parent 57b7b7c commit 937edf1
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public interface ITransferringAcademy
string? DistanceFromAcademyToTrustHq { get; }
string? DistanceFromAcademyToTrustHqDetails { get; }
string? PublishedAdmissionNumber { get; }
string? Region { get; }
string? LocalAuthority { get; }

void SetSchoolAdditionalData(string latestOfstedReportAdditionalInformation, string pupilNumbersAdditionalInformation, string keyStage2PerformanceAdditionalInformation, string keyStage4PerformanceAdditionalInformation, string keyStage5PerformanceAdditionalInformation);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public interface ITransferProjectQueryService
{
Task<AcademyTransferProjectResponse?> GetByUrn(int Urn);
Task<AcademyTransferProjectResponse?> GetById(int id);
Task<IEnumerable<AcademyTransferProjectResponse>?> GetTransferProjectsByIncomingTrustUkprn(string ukprn, CancellationToken cancellationToken);
Task<IEnumerable<AcademyTransferProjectSummaryResponse>?> GetTransferProjectsByIncomingTrustUkprn(string ukprn, CancellationToken cancellationToken);
Task<PagedResultResponse<AcademyTransferProjectSummaryResponse>> GetTransferProjects(int page, int count, int? urn,
string title);
Task<PagedDataResponse<AcademyTransferProjectSummaryResponse>?> GetProjects(IEnumerable<string>? states, string? title, IEnumerable<string>? deliveryOfficers, int page, int count);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ public async Task GetProjects_ReturnsFilteredProjects()
IncomingTrustName = a.IncomingTrustName,
IncomingTrustUkprn = a.IncomingTrustUkprn,
OutgoingAcademyUkprn = a.OutgoingAcademyUkprn,
Region = a.Region,
LocalAuthority = a.LocalAuthority
}).ToList(),
AssignedUser = null!,
IsFormAMat = false
Expand Down Expand Up @@ -301,14 +303,14 @@ public async Task GetTransferProjectsByIncomingTrustUkprn_ShouldReturnTranferPro
);
var cancelationToken = CancellationToken.None;
_mockTransferProjectRepository.Setup(repo => repo.GetTransferProjectsByIncomingTrustUkprn(trustUrn, cancelationToken))
.ReturnsAsync([(ITransferProject?)dummyTransferProject!]);
var expectedResponse = AcademyTransferProjectResponseFactory.Create(dummyTransferProject);
.ReturnsAsync([(dummyTransferProject!)]);
var expectedResponse = _service.AcademyTransferProjectSummaryResponse([dummyTransferProject]);

// Action
var result = await _service.GetTransferProjectsByIncomingTrustUkprn(trustUrn, cancelationToken);

// Assert
result.Should().BeEquivalentTo([expectedResponse]);
result.Should().BeEquivalentTo(expectedResponse);
}
[Fact]
public async Task GetTransferProjectsByIncomingTrustUkprn_ShouldReturnNoTranferProject()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ public static AcademyTransferProjectResponse Create(ITransferProject model)
{
if (model == null)
{
return null;
return null!;
}

var transferringAcademies = model.TransferringAcademies
.Select(a => new TransferringAcademyDto
{
Expand All @@ -31,7 +31,9 @@ public static AcademyTransferProjectResponse Create(ITransferProject model)
ViabilityIssues = a.ViabilityIssues,
FinancialDeficit = a.FinancialDeficit,
MPNameAndParty = a.MPNameAndParty,
PublishedAdmissionNumber = a.PublishedAdmissionNumber
PublishedAdmissionNumber = a.PublishedAdmissionNumber,
LocalAuthority = a.LocalAuthority,
Region = a.Region
})
.ToList();

Expand Down Expand Up @@ -95,9 +97,9 @@ public static AcademyTransferProjectResponse Create(ITransferProject model)
{
Id = model.Id,
ProjectUrn = model.Urn.ToString(),
ProjectReference = model.ProjectReference,
ProjectReference = model.ProjectReference!,
OutgoingTrustUkprn = model.OutgoingTrustUkprn,
OutgoingTrustName = model.OutgoingTrustName,
OutgoingTrustName = model.OutgoingTrustName!,
TransferringAcademies = transferringAcademies,
Features = features,
Dates = dates,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using Dfe.Academies.Academisation.Service.Factories;
using Dfe.Academies.Academisation.Service.Mappers.TransferProject;
using Dfe.Academies.Contracts.V4.Establishments;
using static System.Net.WebRequestMethods;

namespace Dfe.Academies.Academisation.Service.Queries
{
Expand Down Expand Up @@ -45,12 +44,10 @@ public TransferProjectQueryService(
public async Task<PagedResultResponse<AcademyTransferProjectSummaryResponse>> GetTransferProjects(int page, int count, int? urn,
string title)
{
IEnumerable<ITransferProject> transferProjects = FilterByUrn(
await _transferProjectRepository.GetAllTransferProjects(), urn).ToList();
var transferProjects = FilterByUrn(await _transferProjectRepository.GetAllTransferProjects(), urn).ToList();

//the logic retrieving the trust data goes here
IEnumerable<AcademyTransferProjectSummaryResponse> projects =
FilterByIncomingTrust(title, AcademyTransferProjectSummaryResponse(transferProjects));
var projects = FilterByIncomingTrust(title, AcademyTransferProjectSummaryResponse(transferProjects));

// remove any projects without an outgoing trust.
projects = projects
Expand Down Expand Up @@ -231,22 +228,21 @@ public IEnumerable<AcademyTransferProjectSummaryResponse> AcademyTransferProject
FinancialDeficit = ta.FinancialDeficit,
ViabilityIssues = ta.ViabilityIssues,
MPNameAndParty = ta.MPNameAndParty,
PublishedAdmissionNumber = ta.PublishedAdmissionNumber
PublishedAdmissionNumber = ta.PublishedAdmissionNumber,
LocalAuthority = ta.LocalAuthority,
Region = ta.Region,
};
}).ToList(),
IsFormAMat = x.IsFormAMat
};
});
}

public async Task<IEnumerable<AcademyTransferProjectResponse>?> GetTransferProjectsByIncomingTrustUkprn(string ukprn, CancellationToken cancellationToken)
public async Task<IEnumerable<AcademyTransferProjectSummaryResponse>?> GetTransferProjectsByIncomingTrustUkprn(string ukprn, CancellationToken cancellationToken)
{
var transferProjects = await _transferProjectRepository.GetTransferProjectsByIncomingTrustUkprn(ukprn, cancellationToken);
var transers = new List<AcademyTransferProjectResponse>();
foreach (var transferProject in transferProjects) {
transers.Add(AcademyTransferProjectResponseFactory.Create(transferProject!));
}
return transers;

return AcademyTransferProjectSummaryResponse(transferProjects);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ public async Task<ActionResult<IEnumerable<OpeningDateHistoryDto>>> GetOpeningDa
}

[HttpGet("{ukprn}/get-transfers-by-incoming-trust", Name = "GetTransfersByIncomingTrust")]
public async Task<ActionResult<IEnumerable<AcademyTransferProjectResponse>>> GetTransfersByincomingTrust(string ukprn, CancellationToken cancellationToken)
public async Task<ActionResult<IEnumerable<AcademyTransferProjectSummaryResponse>>> GetTransfersByincomingTrust(string ukprn, CancellationToken cancellationToken)
{
_logger.LogInformation("Getting transfer projects by incoming trust ukprn: {value}", ukprn);

Expand Down

0 comments on commit 937edf1

Please sign in to comment.