Skip to content

Commit

Permalink
Merge pull request #599 from DFE-Digital/feature/add-trust-reference-…
Browse files Browse the repository at this point in the history
…number-to-transfer-project

fix for project enrichment - projects without a trust reference
  • Loading branch information
paullocknimble authored Oct 30, 2024
2 parents 5f68cc6 + e843b07 commit a3616b2
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,19 @@ public async Task Execute()
foreach (var project in incompleteProjects)
{
EstablishmentDto? school = await establishmentRepository.GetEstablishment(project.Details.Urn);
// trust could be null here for sposored conversion that do not have a preferred trust
TrustDto trust = await establishmentRepository.GetTrustByReferenceNumber(project.Details.TrustReferenceNumber);



if (school == null)
{
logger.LogWarning("No schools found for project - {project}, urn - {urn}", project.Id, project.Details.Urn);
continue;
}

if (trust == null)
{
logger.LogWarning("No trusts found for project - {project}, urn - {urn}", project.Id, project.Details.Urn);
continue;
}

var projectChanges = new ConversionProjectServiceModel(project.Id, project.Details.Urn)
{

TrustUkprn = Int32.Parse(trust.Ukprn),
TrustUkprn = int.TryParse(trust?.Ukprn, out var ukprn) ? ukprn : null,
LocalAuthority = school.LocalAuthorityName,
Region = school.Gor.Name,
SchoolPhase = school.PhaseOfEducation.Name,
Expand Down

0 comments on commit a3616b2

Please sign in to comment.