Skip to content

Commit

Permalink
Merge pull request #338 from DFE-Digital/feature/default-sponsored-gr…
Browse files Browse the repository at this point in the history
…ant-amounts

Enriching School phase name
  • Loading branch information
dneed-nimble authored Sep 18, 2023
2 parents 870ba38 + cf2bfea commit 845590f
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public EstablishmentGetDataQuery(ILogger<EstablishmentGetDataQuery> logger, IAca
public async Task<IData.Establishment.Establishment?> GetEstablishment(int urn)
{
var client = _academiesApiClientFactory.Create(_correlationContext);
var response = await client.GetAsync($"/establishment/urn/{urn}");
var response = await client.GetAsync($"/establishment/urn/{urn}");

if (!response.IsSuccessStatusCode)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public IncompleteProjectsGetDataQuery(AcademisationContext context)
public async Task<IEnumerable<IProject>?> GetIncompleteProjects()
{
var createdProjectState = await _context.Projects
.Where(p => string.IsNullOrEmpty(p.LocalAuthority) || string.IsNullOrEmpty(p.Region))
.Where(p => string.IsNullOrEmpty(p.LocalAuthority) || string.IsNullOrEmpty(p.Region) || string.IsNullOrEmpty(p.SchoolPhase))
.ToListAsync();

return createdProjectState.Select(p => p.MapToDomain());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public CommandResult Update(ProjectDetails detailsToUpdate)
Form7ReceivedDate = detailsToUpdate.Form7ReceivedDate,
ProposedAcademyOpeningDate = detailsToUpdate.ProposedAcademyOpeningDate,
SchoolAndTrustInformationSectionComplete = detailsToUpdate.SchoolAndTrustInformationSectionComplete,
ConversionSupportGrantAmount = CalculateDefaultSponsoredGrant(Details.ConversionSupportGrantType, detailsToUpdate.ConversionSupportGrantType, detailsToUpdate.ConversionSupportGrantAmount, detailsToUpdate.ConversionSupportGrantAmountChanged, detailsToUpdate.SchoolPhase),
ConversionSupportGrantAmount = CalculateDefaultSponsoredGrant(Details.ConversionSupportGrantType, detailsToUpdate.ConversionSupportGrantType, detailsToUpdate.ConversionSupportGrantAmount, detailsToUpdate.ConversionSupportGrantAmountChanged, detailsToUpdate.SchoolPhase ?? Details.SchoolPhase),
ConversionSupportGrantChangeReason = NullifyGrantChangeReasonIfNeeded(detailsToUpdate.ConversionSupportGrantAmountChanged, detailsToUpdate.ConversionSupportGrantChangeReason, detailsToUpdate.AcademyTypeAndRoute),
ConversionSupportGrantType = detailsToUpdate.ConversionSupportGrantType,
ConversionSupportGrantEnvironmentalImprovementGrant = detailsToUpdate.ConversionSupportGrantEnvironmentalImprovementGrant,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,17 @@ public Establishment()
}

public string? LocalAuthorityName { get; set; }
public NameAndCodeResponse PhaseOfEducation { get; set; }
public Region Gor { get; set; }

public class Region
{
public string? Name { get; set; }
}
public class NameAndCodeResponse
{
public string Name { get; set; }
public string Code { get; set; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public LegacyProjectServiceModel(int id, int urn)
public string? ConversionSupportGrantType { get; init; }
public string? ConversionSupportGrantEnvironmentalImprovementGrant { get; init; }
public bool? ConversionSupportGrantAmountChanged { get; init; }
public string? Region { get; init; }
[JsonIgnore] public string? SchoolPhase { get; init; }
public string? Region { get; init; }
public string? SchoolPhase { get; init; }
[JsonIgnore] public string? AgeRange { get; init; }
[JsonIgnore] public string? SchoolType { get; init; }
[JsonIgnore] public int? ActualPupilNumbers { get; init; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public async Task Execute()

var projectChanges = new LegacyProjectServiceModel(project.Id, project.Details.Urn)
{
LocalAuthority = school.LocalAuthorityName, Region = school.Gor.Name
LocalAuthority = school.LocalAuthorityName, Region = school.Gor.Name, SchoolPhase = school.PhaseOfEducation.Name
};

project.Update(LegacyProjectDetailsMapper.MapNonEmptyFields(projectChanges, project));
Expand Down

0 comments on commit 845590f

Please sign in to comment.