Skip to content

Commit

Permalink
Including Age Range in export
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominic NEED authored and Dominic NEED committed Oct 8, 2024
1 parent 5b0af3c commit 73f9252
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed

- Changed when we intercept automation headers to give automation users claims for Edit contact tests
- Academies in this trust export now includes Age Range

## [Release-9][release-9] (production-2024-10-02.3440)

Expand Down
16 changes: 14 additions & 2 deletions DfE.FindInformationAcademiesTrusts/Services/ExportService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public byte[] ExportAcademiesToSpreadsheetUsingProvider(Data.Trust trust, Trust.
"School Name", "URN", "Local Authority", "Type", "Rural or Urban", "Date joined",
"Previous Ofsted Rating", "Before/After Joining","Date of Previous Ofsted",
"Current Ofsted Rating", "Before/After Joining", "Date of Current Ofsted",
"Phase of Education", "Pupil Numbers", "Capacity", "% Full", "Pupils eligible for Free School Meals"
"Phase of Education", "Age Range", "Pupil Numbers", "Capacity", "% Full", "Pupils eligible for Free School Meals"
};

var academies = trust.Academies;
Expand All @@ -36,6 +36,7 @@ public byte[] ExportAcademiesToSpreadsheetUsingProvider(Data.Trust trust, Trust.
var previousRating = ofstedData?.PreviousOfstedRating ?? OfstedRating.None;
var currentRating = ofstedData?.CurrentOfstedRating ?? OfstedRating.None;
var ageRangeString = GetAgeRangeString(academy);
return
[
academy.EstablishmentName ?? string.Empty,
Expand All @@ -51,16 +52,27 @@ public byte[] ExportAcademiesToSpreadsheetUsingProvider(Data.Trust trust, Trust.
IsOfstedRatingBeforeOrAfterJoining(currentRating?.OfstedRatingScore ?? OfstedRatingScore.None, academy.DateAcademyJoinedTrust, currentRating?.InspectionDate),
currentRating?.InspectionDate?.ToString(StringFormatConstants.ViewDate) ?? string.Empty,
academy.PhaseOfEducation ?? string.Empty,
ageRangeString,
academy.NumberOfPupils?.ToString() ?? string.Empty,
academy.SchoolCapacity?.ToString() ?? string.Empty,
academy.PercentageFull.HasValue ? $"{academy.PercentageFull}%" : string.Empty,
academy.PercentageFreeSchoolMeals.HasValue ? $"{academy.PercentageFreeSchoolMeals}%" : string.Empty
academy.PercentageFreeSchoolMeals.HasValue ? $"{academy.PercentageFreeSchoolMeals}%" : string.Empty,
];
});

return GenerateSpreadsheet(trustSummary, academies, headers, dataExtractor);
}

private static string GetAgeRangeString(Data.Academy academy)
{
if (academy.AgeRange is not null)
{
return $"{academy.AgeRange.Minimum} - {academy.AgeRange.Maximum}";
}

return string.Empty;
}

public static string IsOfstedRatingBeforeOrAfterJoining(OfstedRatingScore ofstedRatingScore, DateTime dateAcademyJoinedTrust, DateTime? inspectionEndDate)
{
if (ofstedRatingScore == OfstedRatingScore.None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ public void ExportAcademiesToSpreadsheetUsingProvider_ShouldGenerateCorrectHeade
worksheet.Cell(3, 11).Value.ToString().Should().Be("Before/After Joining");
worksheet.Cell(3, 12).Value.ToString().Should().Be("Date of Current Ofsted");
worksheet.Cell(3, 13).Value.ToString().Should().Be("Phase of Education");
worksheet.Cell(3, 14).Value.ToString().Should().Be("Pupil Numbers");
worksheet.Cell(3, 15).Value.ToString().Should().Be("Capacity");
worksheet.Cell(3, 16).Value.ToString().Should().Be("% Full");
worksheet.Cell(3, 17).Value.ToString().Should().Be("Pupils eligible for Free School Meals");
worksheet.Cell(3, 14).Value.ToString().Should().Be("Age Range");
worksheet.Cell(3, 15).Value.ToString().Should().Be("Pupil Numbers");
worksheet.Cell(3, 16).Value.ToString().Should().Be("Capacity");
worksheet.Cell(3, 17).Value.ToString().Should().Be("% Full");
worksheet.Cell(3, 18).Value.ToString().Should().Be("Pupils eligible for Free School Meals");
}

[Fact]
Expand Down Expand Up @@ -134,10 +135,11 @@ public void ExportAcademiesToSpreadsheetUsingProvider_ShouldCorrectlyExtractAcad
worksheet.Cell(4, 11).Value.ToString().Should().Be("After Joining");
worksheet.Cell(4, 12).Value.ToString().Should().Be(DateTime.Now.ToString(StringFormatConstants.ViewDate));
worksheet.Cell(4, 13).Value.ToString().Should().Be("Primary");
worksheet.Cell(4, 14).Value.ToString().Should().Be("500");
worksheet.Cell(4, 15).Value.ToString().Should().Be("600");
worksheet.Cell(4, 16).Value.ToString().Should().Be("83%");
worksheet.Cell(4, 17).Value.ToString().Should().Be("20%");
worksheet.Cell(4, 14).Value.ToString().Should().Be("5 - 11");
worksheet.Cell(4, 15).Value.ToString().Should().Be("500");
worksheet.Cell(4, 16).Value.ToString().Should().Be("600");
worksheet.Cell(4, 17).Value.ToString().Should().Be("83%");
worksheet.Cell(4, 18).Value.ToString().Should().Be("20%");
}

[Fact]
Expand Down Expand Up @@ -238,10 +240,11 @@ public void ExportAcademiesToSpreadsheetUsingProvider_ShouldCorrectlyHandleNullV
worksheet.Cell(4, 11).Value.ToString().Should().Be(string.Empty);
worksheet.Cell(4, 12).Value.ToString().Should().Be(string.Empty);
worksheet.Cell(4, 13).Value.ToString().Should().Be(string.Empty);
worksheet.Cell(4, 14).Value.ToString().Should().Be(string.Empty);
worksheet.Cell(4, 14).Value.ToString().Should().Be("5 - 11");
worksheet.Cell(4, 15).Value.ToString().Should().Be(string.Empty);
worksheet.Cell(4, 16).Value.ToString().Should().Be(string.Empty);
worksheet.Cell(4, 17).Value.ToString().Should().Be(string.Empty);
worksheet.Cell(4, 18).Value.ToString().Should().Be(string.Empty);
}

[Fact]
Expand Down

0 comments on commit 73f9252

Please sign in to comment.