From cef992011b317679a012e8a585b14c435443743a Mon Sep 17 00:00:00 2001 From: Sara Gowen <9001998+dynamictulip@users.noreply.github.com> Date: Fri, 17 Jan 2025 17:28:51 +0000 Subject: [PATCH 01/21] Replace important dates subpage with single headline grades page --- .../Pages/Trusts/Ofsted/ImportantDates.cshtml | 48 -------------- .../Pages/Trusts/Ofsted/OfstedAreaModel.cs | 16 ++--- .../Trusts/Ofsted/SingleHeadlineGrades.cshtml | 64 +++++++++++++++++++ ...html.cs => SingleHeadlineGrades.cshtml.cs} | 6 +- .../Pages/Trusts/TrustsAreaModel.cs | 5 +- .../Pages/ViewConstants.cs | 14 ++-- .../Pages/Trusts/BaseTrustPageTests.cs | 2 +- .../Trusts/Ofsted/BaseOfstedAreaModelTests.cs | 14 ++-- ...s.cs => SingleHeadlineGradesModelTests.cs} | 12 ++-- 9 files changed, 96 insertions(+), 85 deletions(-) delete mode 100644 DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/ImportantDates.cshtml create mode 100644 DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml rename DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/{ImportantDates.cshtml.cs => SingleHeadlineGrades.cshtml.cs} (80%) rename tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/Ofsted/{ImportantDatesModelTests.cs => SingleHeadlineGradesModelTests.cs} (65%) diff --git a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/ImportantDates.cshtml b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/ImportantDates.cshtml deleted file mode 100644 index 409be2aa3..000000000 --- a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/ImportantDates.cshtml +++ /dev/null @@ -1,48 +0,0 @@ -@page "/trusts/ofsted/important-dates" -@using DfE.FindInformationAcademiesTrusts.Extensions -@model ImportantDatesModel - -@{ - Layout = "Ofsted/_OfstedLayout"; -} - -
- - - - - - - - - - - - @foreach (var academy in Model.Academies) - { - - - - - - - } - -
Important dates
- School name - - Date joined - - Date of current inspection - - Date of previous inspection -
- @academy.EstablishmentName
-
- @academy.DateAcademyJoinedTrust.ToString(StringFormatConstants.DisplayDateFormat) - - @academy.CurrentOfstedRating.InspectionDate.ShowDateStringOrReplaceWithText() - - @academy.PreviousOfstedRating.InspectionDate.ShowDateStringOrReplaceWithText() -
-
diff --git a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/OfstedAreaModel.cs b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/OfstedAreaModel.cs index c83b7bec5..175d258b6 100644 --- a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/OfstedAreaModel.cs +++ b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/OfstedAreaModel.cs @@ -35,18 +35,14 @@ public override async Task OnGetAsync() SubNavigationLinks = [ + new TrustSubNavigationLinkModel(ViewConstants.OfstedSingleHeadlineGradesPageName, "./SingleHeadlineGrades", + Uid, TrustPageMetadata.PageName!, this is SingleHeadlineGradesModel), new TrustSubNavigationLinkModel(ViewConstants.OfstedCurrentRatingsPageName, "./CurrentRatings", Uid, - TrustPageMetadata.PageName!, - this is CurrentRatingsModel), + TrustPageMetadata.PageName!, this is CurrentRatingsModel), new TrustSubNavigationLinkModel(ViewConstants.OfstedPreviousRatingsPageName, "./PreviousRatings", Uid, - TrustPageMetadata.PageName!, - this is PreviousRatingsModel), - new TrustSubNavigationLinkModel(ViewConstants.OfstedImportantDatesPageName, "./ImportantDates", Uid, - TrustPageMetadata.PageName!, - this is ImportantDatesModel), + TrustPageMetadata.PageName!, this is PreviousRatingsModel), new TrustSubNavigationLinkModel(ViewConstants.OfstedSafeguardingAndConcernsPageName, - "./SafeguardingAndConcerns", Uid, - TrustPageMetadata.PageName!, this is SafeguardingAndConcernsModel) + "./SafeguardingAndConcerns", Uid, TrustPageMetadata.PageName!, this is SafeguardingAndConcernsModel) ]; // Add data sources @@ -66,7 +62,7 @@ public override async Task OnGetAsync() new DataSourceListEntry(misDataSource, "Date of previous inspection") ] ), - new DataSourcePageListEntry(ViewConstants.OfstedImportantDatesPageName, [ + new DataSourcePageListEntry(ViewConstants.OfstedSingleHeadlineGradesPageName, [ dateJoinedTrust, new DataSourceListEntry(misDataSource, "Date of current inspection"), new DataSourceListEntry(misDataSource, "Date of previous inspection") diff --git a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml new file mode 100644 index 000000000..d5a10656b --- /dev/null +++ b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml @@ -0,0 +1,64 @@ +@page "/trusts/ofsted/single-headline-grades" +@using DfE.FindInformationAcademiesTrusts.Extensions +@model SingleHeadlineGradesModel + +@{ + Layout = "Ofsted/_OfstedLayout"; +} + +
+ + + + + + + + + + + + + + @foreach (var academy in Model.Academies) + { + + + + + + + + + } + +
Single headline grades
+ School name + + Date joined + + Current single headline grade + + Date of current inspection + + Previous single headline grade + + Date of previous inspection +
+ @academy.EstablishmentName
+
+ @academy.DateAcademyJoinedTrust.ToString(StringFormatConstants.DisplayDateFormat) + + @academy.CurrentOfstedRating.OverallEffectiveness.ToDisplayString() +
+ @await Html.PartialAsync("_BeforeOrAfterTag", academy.WhenDidCurrentInspectionHappen) +
+ @academy.CurrentOfstedRating.InspectionDate.ShowDateStringOrReplaceWithText() + + @academy.PreviousOfstedRating.OverallEffectiveness.ToDisplayString() +
+ @await Html.PartialAsync("_BeforeOrAfterTag", academy.WhenDidCurrentInspectionHappen) +
+ @academy.PreviousOfstedRating.InspectionDate.ShowDateStringOrReplaceWithText() +
+
diff --git a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/ImportantDates.cshtml.cs b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml.cs similarity index 80% rename from DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/ImportantDates.cshtml.cs rename to DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml.cs index 9d75d71b0..12f356ef3 100644 --- a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/ImportantDates.cshtml.cs +++ b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml.cs @@ -6,15 +6,15 @@ namespace DfE.FindInformationAcademiesTrusts.Pages.Trusts.Ofsted; -public class ImportantDatesModel( +public class SingleHeadlineGradesModel( IDataSourceService dataSourceService, ITrustService trustService, IAcademyService academyService, IExportService exportService, IDateTimeProvider dateTimeProvider, - ILogger logger) : OfstedAreaModel(dataSourceService, trustService, + ILogger logger) : OfstedAreaModel(dataSourceService, trustService, academyService, exportService, dateTimeProvider, logger) { public override TrustPageMetadata TrustPageMetadata => - base.TrustPageMetadata with { SubPageName = ViewConstants.OfstedImportantDatesPageName }; + base.TrustPageMetadata with { SubPageName = ViewConstants.OfstedSingleHeadlineGradesPageName }; } diff --git a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/TrustsAreaModel.cs b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/TrustsAreaModel.cs index b2b61b4b9..2f2fcdda8 100644 --- a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/TrustsAreaModel.cs +++ b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/TrustsAreaModel.cs @@ -84,9 +84,8 @@ private void InitializeNavigationLinks() new TrustNavigationLinkModel($"{ViewConstants.AcademiesPageName} ({TrustSummary.NumberOfAcademies})", "/Trusts/Academies/Details", Uid, this is AcademiesPageModel, "academies-nav"), - new TrustNavigationLinkModel(ViewConstants.OfstedPageName, "/Trusts/Ofsted/CurrentRatings", Uid, - this is OfstedAreaModel, - "ofsted-nav"), + new TrustNavigationLinkModel(ViewConstants.OfstedPageName, "/Trusts/Ofsted/SingleHeadlineGrades", Uid, + this is OfstedAreaModel, "ofsted-nav"), new TrustNavigationLinkModel(ViewConstants.GovernancePageName, "/Trusts/Governance/TrustLeadership", Uid, this is GovernanceAreaModel, "governance-nav") ]; diff --git a/DfE.FindInformationAcademiesTrusts/Pages/ViewConstants.cs b/DfE.FindInformationAcademiesTrusts/Pages/ViewConstants.cs index bb8931307..b5441b8d8 100644 --- a/DfE.FindInformationAcademiesTrusts/Pages/ViewConstants.cs +++ b/DfE.FindInformationAcademiesTrusts/Pages/ViewConstants.cs @@ -27,27 +27,27 @@ public static class ViewConstants public static readonly List ExternalServiceLinks = [ - new ExternalServiceLink("Prepare conversions and transfers", + new("Prepare conversions and transfers", "Create a transfer or conversion project document for an advisory board.", "https://educationgovuk.sharepoint.com/sites/lvewp00299/SitePages/Prepare-Conversions-and-Transfers.aspx"), - new ExternalServiceLink("Complete conversions, transfers and changes", + new("Complete conversions, transfers and changes", "Manage a conversion or transfer project after it has been to an advisory board.", "https://educationgovuk.sharepoint.com/sites/lvewp00299/SitePages/complete-conversions-transfers-and-changes.aspx"), - new ExternalServiceLink("Record concerns or support for trusts", + new("Record concerns or support for trusts", "Add cases or interactions, record risks and log support and concerns for trusts.", "https://educationgovuk.sharepoint.com/sites/lvewp00299/SitePages/Record-concerns-and-support-for-trusts.aspx"), - new ExternalServiceLink("Manage free school projects", + new("Manage free school projects", "Manage presumption projects in the pre-opening phase.", "https://educationgovuk.sharepoint.com/sites/lvewp00299/SitePages/Manage-free-school-projects.aspx?web=1"), - new ExternalServiceLink("Reporting and data tools", + new("Reporting and data tools", "Tools to help you gather educational data and create reports.", "https://educationgovuk.sharepoint.com/sites/lvewp00299/SitePages/reportinganddata.aspx"), - new ExternalServiceLink("High quality trust framework", + new("High quality trust framework", "Process guidance and tools for making trust-related project decisions.", "https://educationgovuk.sharepoint.com/sites/lvewp00299/SitePages/RG%20high%20quality%20trust%20framework.aspx") ]; @@ -67,9 +67,9 @@ public static class ViewConstants public const string AcademiesFreeSchoolMealsPageName = "Free school meals"; public const string OfstedPageName = "Ofsted"; + public const string OfstedSingleHeadlineGradesPageName = "Single headline grades"; public const string OfstedCurrentRatingsPageName = "Current ratings"; public const string OfstedPreviousRatingsPageName = "Previous ratings"; - public const string OfstedImportantDatesPageName = "Important dates"; public const string OfstedSafeguardingAndConcernsPageName = "Safeguarding and concerns"; public const string GovernancePageName = "Governance"; diff --git a/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/BaseTrustPageTests.cs b/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/BaseTrustPageTests.cs index 5ad8d4ab0..0c6c94585 100644 --- a/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/BaseTrustPageTests.cs +++ b/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/BaseTrustPageTests.cs @@ -112,7 +112,7 @@ public async Task OnGetAsync_should_populate_NavigationLinks() l => { l.LinkText.Should().Be(ViewConstants.OfstedPageName); - l.Page.Should().Be("/Trusts/Ofsted/CurrentRatings"); + l.Page.Should().Be("/Trusts/Ofsted/SingleHeadlineGrades"); l.DataTestId.Should().Be("ofsted-nav"); }, l => diff --git a/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/Ofsted/BaseOfstedAreaModelTests.cs b/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/Ofsted/BaseOfstedAreaModelTests.cs index 566924e9f..07749a88b 100644 --- a/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/Ofsted/BaseOfstedAreaModelTests.cs +++ b/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/Ofsted/BaseOfstedAreaModelTests.cs @@ -35,7 +35,7 @@ public override async Task OnGetAsync_sets_correct_data_source_list() new DataSourceListEntry(MisDataSource, "Date of previous inspection") ] ), - new DataSourcePageListEntry(ViewConstants.OfstedImportantDatesPageName, [ + new DataSourcePageListEntry(ViewConstants.OfstedSingleHeadlineGradesPageName, [ new DataSourceListEntry(GiasDataSource, "Date joined trust"), new DataSourceListEntry(MisDataSource, "Date of current inspection"), new DataSourceListEntry(MisDataSource, "Date of previous inspection") @@ -159,20 +159,20 @@ public async Task OnGetAsync_should_populate_SubNavigationLinks_to_subpages() .SatisfyRespectively( l => { - l.LinkText.Should().Be("Current ratings"); - l.SubPageLink.Should().Be("./CurrentRatings"); + l.LinkText.Should().Be("Single headline grades"); + l.SubPageLink.Should().Be("./SingleHeadlineGrades"); l.ServiceName.Should().Be("Ofsted"); }, l => { - l.LinkText.Should().Be("Previous ratings"); - l.SubPageLink.Should().Be("./PreviousRatings"); + l.LinkText.Should().Be("Current ratings"); + l.SubPageLink.Should().Be("./CurrentRatings"); l.ServiceName.Should().Be("Ofsted"); }, l => { - l.LinkText.Should().Be("Important dates"); - l.SubPageLink.Should().Be("./ImportantDates"); + l.LinkText.Should().Be("Previous ratings"); + l.SubPageLink.Should().Be("./PreviousRatings"); l.ServiceName.Should().Be("Ofsted"); }, l => diff --git a/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/Ofsted/ImportantDatesModelTests.cs b/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/Ofsted/SingleHeadlineGradesModelTests.cs similarity index 65% rename from tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/Ofsted/ImportantDatesModelTests.cs rename to tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/Ofsted/SingleHeadlineGradesModelTests.cs index c13bade3f..29fbe61a0 100644 --- a/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/Ofsted/ImportantDatesModelTests.cs +++ b/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/Ofsted/SingleHeadlineGradesModelTests.cs @@ -3,16 +3,16 @@ namespace DfE.FindInformationAcademiesTrusts.UnitTests.Pages.Trusts.Ofsted; -public class ImportantDatesModelTests : BaseOfstedAreaModelTests +public class SingleHeadlineGradesModelTests : BaseOfstedAreaModelTests { - public ImportantDatesModelTests() + public SingleHeadlineGradesModelTests() { - Sut = new ImportantDatesModel(MockDataSourceService.Object, + Sut = new SingleHeadlineGradesModel(MockDataSourceService.Object, MockTrustService.Object, MockAcademyService.Object, MockExportService.Object, MockDateTimeProvider.Object, - new MockLogger().Object + new MockLogger().Object ) { Uid = TrustUid }; } @@ -23,7 +23,7 @@ public override async Task OnGetAsync_should_set_active_SubNavigationLink_to_cur _ = await Sut.OnGetAsync(); Sut.SubNavigationLinks.Should().ContainSingle(l => l.LinkIsActive) - .Which.SubPageLink.Should().Be("./ImportantDates"); + .Which.SubPageLink.Should().Be("./SingleHeadlineGrades"); } [Fact] @@ -31,6 +31,6 @@ public override async Task OnGetAsync_should_configure_TrustPageMetadata_SubPage { _ = await Sut.OnGetAsync(); - Sut.TrustPageMetadata.SubPageName.Should().Be("Important dates"); + Sut.TrustPageMetadata.SubPageName.Should().Be("Single headline grades"); } } From f1a4aee28a423262be1979242190ffc8e4c7012f Mon Sep 17 00:00:00 2001 From: Sara Gowen <9001998+dynamictulip@users.noreply.github.com> Date: Thu, 23 Jan 2025 16:39:22 +0000 Subject: [PATCH 02/21] Update Ofsted data source for single headline grades table --- .../Pages/Trusts/Ofsted/OfstedAreaModel.cs | 14 ++++++-------- .../Trusts/Ofsted/BaseOfstedAreaModelTests.cs | 12 ++++++------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/OfstedAreaModel.cs b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/OfstedAreaModel.cs index 175d258b6..d5b87ded1 100644 --- a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/OfstedAreaModel.cs +++ b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/OfstedAreaModel.cs @@ -49,9 +49,13 @@ public override async Task OnGetAsync() var giasDataSource = await DataSourceService.GetAsync(Source.Gias); var misDataSource = await DataSourceService.GetAsync(Source.Mis); - var dateJoinedTrust = new DataSourceListEntry(giasDataSource, "Date joined trust"); - DataSourcesPerPage.AddRange([ + new DataSourcePageListEntry(ViewConstants.OfstedSingleHeadlineGradesPageName, [ + new DataSourceListEntry(giasDataSource, "Date joined trust"), + new DataSourceListEntry(misDataSource, "All single headline grades"), + new DataSourceListEntry(misDataSource, "All inspection dates") + ] + ), new DataSourcePageListEntry(ViewConstants.OfstedCurrentRatingsPageName, [ new DataSourceListEntry(misDataSource, "Current Ofsted rating"), new DataSourceListEntry(misDataSource, "Date of current inspection") @@ -62,12 +66,6 @@ public override async Task OnGetAsync() new DataSourceListEntry(misDataSource, "Date of previous inspection") ] ), - new DataSourcePageListEntry(ViewConstants.OfstedSingleHeadlineGradesPageName, [ - dateJoinedTrust, - new DataSourceListEntry(misDataSource, "Date of current inspection"), - new DataSourceListEntry(misDataSource, "Date of previous inspection") - ] - ), new DataSourcePageListEntry(ViewConstants.OfstedSafeguardingAndConcernsPageName, [ new DataSourceListEntry(misDataSource, "Effective safeguarding"), new DataSourceListEntry(misDataSource, "Category of concern"), diff --git a/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/Ofsted/BaseOfstedAreaModelTests.cs b/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/Ofsted/BaseOfstedAreaModelTests.cs index 07749a88b..0bb17ae3c 100644 --- a/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/Ofsted/BaseOfstedAreaModelTests.cs +++ b/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/Ofsted/BaseOfstedAreaModelTests.cs @@ -25,6 +25,12 @@ public override async Task OnGetAsync_sets_correct_data_source_list() MockDataSourceService.Verify(e => e.GetAsync(Source.Mis), Times.Once); Sut.DataSourcesPerPage.Should().BeEquivalentTo([ + new DataSourcePageListEntry(ViewConstants.OfstedSingleHeadlineGradesPageName, [ + new DataSourceListEntry(GiasDataSource, "Date joined trust"), + new DataSourceListEntry(MisDataSource, "All single headline grades"), + new DataSourceListEntry(MisDataSource, "All inspection dates") + ] + ), new DataSourcePageListEntry(ViewConstants.OfstedCurrentRatingsPageName, [ new DataSourceListEntry(MisDataSource, "Current Ofsted rating"), new DataSourceListEntry(MisDataSource, "Date of current inspection") @@ -35,12 +41,6 @@ public override async Task OnGetAsync_sets_correct_data_source_list() new DataSourceListEntry(MisDataSource, "Date of previous inspection") ] ), - new DataSourcePageListEntry(ViewConstants.OfstedSingleHeadlineGradesPageName, [ - new DataSourceListEntry(GiasDataSource, "Date joined trust"), - new DataSourceListEntry(MisDataSource, "Date of current inspection"), - new DataSourceListEntry(MisDataSource, "Date of previous inspection") - ] - ), new DataSourcePageListEntry(ViewConstants.OfstedSafeguardingAndConcernsPageName, [ new DataSourceListEntry(MisDataSource, "Effective safeguarding"), new DataSourceListEntry(MisDataSource, "Category of concern"), From 7562da163fd5f8ae485adc5ef351c4d9704cfe22 Mon Sep 17 00:00:00 2001 From: Sara Gowen <9001998+dynamictulip@users.noreply.github.com> Date: Fri, 24 Jan 2025 12:16:25 +0000 Subject: [PATCH 03/21] Display "Not inspected" for previous ratings Note - this change will only occur on the display as altering the spreadsheet export is out of scope --- .../Extensions/OfstedRatingScoreExtensions.cs | 21 ++++----- .../Pages/Trusts/Ofsted/CurrentRatings.cshtml | 14 +++--- .../Trusts/Ofsted/PreviousRatings.cshtml | 14 +++--- .../Ofsted/SafeguardingAndConcerns.cshtml | 2 +- .../Trusts/Ofsted/SingleHeadlineGrades.cshtml | 18 ++++---- .../Trusts/Ofsted/_BeforeOrAfterTag.cshtml | 10 +++-- .../Trusts/Ofsted/_BeforeOrAfterTag.cshtml.cs | 5 +++ .../Services/Export/ExportService.cs | 33 +++++++------- .../OfstedRatingScoreExtensionsTests.cs | 44 +++++++++---------- 9 files changed, 83 insertions(+), 78 deletions(-) create mode 100644 DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_BeforeOrAfterTag.cshtml.cs diff --git a/DfE.FindInformationAcademiesTrusts/Extensions/OfstedRatingScoreExtensions.cs b/DfE.FindInformationAcademiesTrusts/Extensions/OfstedRatingScoreExtensions.cs index 76e9c8e91..489edf81d 100644 --- a/DfE.FindInformationAcademiesTrusts/Extensions/OfstedRatingScoreExtensions.cs +++ b/DfE.FindInformationAcademiesTrusts/Extensions/OfstedRatingScoreExtensions.cs @@ -20,18 +20,19 @@ public static int ToDataSortValue(this OfstedRatingScore rating) }; } - public static string ToDisplayString(this OfstedRatingScore rating) + public static string ToDisplayString(this OfstedRatingScore rating, bool isCurrentRating) { - return rating switch + return (rating, isCurrentRating) switch { - OfstedRatingScore.Outstanding => "Outstanding", - OfstedRatingScore.Good => "Good", - OfstedRatingScore.RequiresImprovement => "Requires improvement", - OfstedRatingScore.Inadequate => "Inadequate", - OfstedRatingScore.InsufficientEvidence => "Insufficient evidence", - OfstedRatingScore.NoJudgement => "No judgement", - OfstedRatingScore.DoesNotApply => "Does not apply", - OfstedRatingScore.NotInspected => "Not yet inspected", + (OfstedRatingScore.Outstanding, _) => "Outstanding", + (OfstedRatingScore.Good, _) => "Good", + (OfstedRatingScore.RequiresImprovement, _) => "Requires improvement", + (OfstedRatingScore.Inadequate, _) => "Inadequate", + (OfstedRatingScore.InsufficientEvidence, _) => "Insufficient evidence", + (OfstedRatingScore.NoJudgement, _) => "No judgement", + (OfstedRatingScore.DoesNotApply, _) => "Does not apply", + (OfstedRatingScore.NotInspected, true) => "Not yet inspected", + (OfstedRatingScore.NotInspected, false) => "Not inspected", _ => "Unknown" }; } diff --git a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/CurrentRatings.cshtml b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/CurrentRatings.cshtml index 78fd981f5..c1616ccff 100644 --- a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/CurrentRatings.cshtml +++ b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/CurrentRatings.cshtml @@ -45,25 +45,25 @@ @academy.EstablishmentName
- @academy.CurrentOfstedRating.QualityOfEducation.ToDisplayString() + @academy.CurrentOfstedRating.QualityOfEducation.ToDisplayString(true) - @academy.CurrentOfstedRating.BehaviourAndAttitudes.ToDisplayString() + @academy.CurrentOfstedRating.BehaviourAndAttitudes.ToDisplayString(true) - @academy.CurrentOfstedRating.PersonalDevelopment.ToDisplayString() + @academy.CurrentOfstedRating.PersonalDevelopment.ToDisplayString(true) - @academy.CurrentOfstedRating.EffectivenessOfLeadershipAndManagement.ToDisplayString() + @academy.CurrentOfstedRating.EffectivenessOfLeadershipAndManagement.ToDisplayString(true) - @academy.CurrentOfstedRating.EarlyYearsProvision.ToDisplayString() + @academy.CurrentOfstedRating.EarlyYearsProvision.ToDisplayString(true) - @academy.CurrentOfstedRating.SixthFormProvision.ToDisplayString() + @academy.CurrentOfstedRating.SixthFormProvision.ToDisplayString(true) - @await Html.PartialAsync("_BeforeOrAfterTag", academy.WhenDidCurrentInspectionHappen) + } diff --git a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/PreviousRatings.cshtml b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/PreviousRatings.cshtml index 6767b99e5..c80423064 100644 --- a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/PreviousRatings.cshtml +++ b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/PreviousRatings.cshtml @@ -45,25 +45,25 @@ @academy.EstablishmentName
- @academy.PreviousOfstedRating.QualityOfEducation.ToDisplayString() + @academy.PreviousOfstedRating.QualityOfEducation.ToDisplayString(false) - @academy.PreviousOfstedRating.BehaviourAndAttitudes.ToDisplayString() + @academy.PreviousOfstedRating.BehaviourAndAttitudes.ToDisplayString(false) - @academy.PreviousOfstedRating.PersonalDevelopment.ToDisplayString() + @academy.PreviousOfstedRating.PersonalDevelopment.ToDisplayString(false) - @academy.PreviousOfstedRating.EffectivenessOfLeadershipAndManagement.ToDisplayString() + @academy.PreviousOfstedRating.EffectivenessOfLeadershipAndManagement.ToDisplayString(false) - @academy.PreviousOfstedRating.EarlyYearsProvision.ToDisplayString() + @academy.PreviousOfstedRating.EarlyYearsProvision.ToDisplayString(false) - @academy.PreviousOfstedRating.SixthFormProvision.ToDisplayString() + @academy.PreviousOfstedRating.SixthFormProvision.ToDisplayString(false) - @await Html.PartialAsync("_BeforeOrAfterTag", academy.WhenDidPreviousInspectionHappen) + } diff --git a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SafeguardingAndConcerns.cshtml b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SafeguardingAndConcerns.cshtml index 2875a2c5b..ea3ed3867 100644 --- a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SafeguardingAndConcerns.cshtml +++ b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SafeguardingAndConcerns.cshtml @@ -56,7 +56,7 @@ @academy.CurrentOfstedRating.CategoryOfConcern.ToDisplayString() - @await Html.PartialAsync("_BeforeOrAfterTag", academy.WhenDidCurrentInspectionHappen) + } diff --git a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml index d5a10656b..698967f8b 100644 --- a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml +++ b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml @@ -14,19 +14,19 @@ School name - + Date joined - + Current single headline grade - + Date of current inspection - + Previous single headline grade - + Date of previous inspection @@ -42,17 +42,17 @@ @academy.DateAcademyJoinedTrust.ToString(StringFormatConstants.DisplayDateFormat) - @academy.CurrentOfstedRating.OverallEffectiveness.ToDisplayString() + @academy.CurrentOfstedRating.OverallEffectiveness.ToDisplayString(true)
- @await Html.PartialAsync("_BeforeOrAfterTag", academy.WhenDidCurrentInspectionHappen) + @academy.CurrentOfstedRating.InspectionDate.ShowDateStringOrReplaceWithText() - @academy.PreviousOfstedRating.OverallEffectiveness.ToDisplayString() + @academy.PreviousOfstedRating.OverallEffectiveness.ToDisplayString(false)
- @await Html.PartialAsync("_BeforeOrAfterTag", academy.WhenDidCurrentInspectionHappen) + @academy.PreviousOfstedRating.InspectionDate.ShowDateStringOrReplaceWithText() diff --git a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_BeforeOrAfterTag.cshtml b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_BeforeOrAfterTag.cshtml index 9f1abe9da..f3600c3c5 100644 --- a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_BeforeOrAfterTag.cshtml +++ b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_BeforeOrAfterTag.cshtml @@ -1,7 +1,9 @@ -@using DfE.FindInformationAcademiesTrusts.Data.Enums -@model DfE.FindInformationAcademiesTrusts.Data.Enums.BeforeOrAfterJoining +@using DfE.FindInformationAcademiesTrusts.Data +@using DfE.FindInformationAcademiesTrusts.Data.Enums +@using DfE.FindInformationAcademiesTrusts.Extensions +@model BeforeOrAfterTagModel -@switch (Model) +@switch (Model.BeforeOrAfterJoining) { case BeforeOrAfterJoining.After: { @@ -19,7 +21,7 @@ } case BeforeOrAfterJoining.NotYetInspected: { - Not yet inspected + @OfstedRatingScore.NotInspected.ToDisplayString(Model.IsCurrent) break; } default: diff --git a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_BeforeOrAfterTag.cshtml.cs b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_BeforeOrAfterTag.cshtml.cs new file mode 100644 index 000000000..e6935c3c4 --- /dev/null +++ b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_BeforeOrAfterTag.cshtml.cs @@ -0,0 +1,5 @@ +using DfE.FindInformationAcademiesTrusts.Data.Enums; + +namespace DfE.FindInformationAcademiesTrusts.Pages.Trusts.Ofsted; + +public record BeforeOrAfterTagModel(BeforeOrAfterJoining BeforeOrAfterJoining, bool IsCurrent); diff --git a/DfE.FindInformationAcademiesTrusts/Services/Export/ExportService.cs b/DfE.FindInformationAcademiesTrusts/Services/Export/ExportService.cs index ee886fc13..85f11c1dd 100644 --- a/DfE.FindInformationAcademiesTrusts/Services/Export/ExportService.cs +++ b/DfE.FindInformationAcademiesTrusts/Services/Export/ExportService.cs @@ -128,7 +128,7 @@ private static void GenerateAcademyRow( SetDateCell(worksheet, rowNumber, 6, ofstedData?.DateAcademyJoinedTrust); - SetTextCell(worksheet, rowNumber, 7, previousRating.OverallEffectiveness.ToDisplayString()); + SetTextCell(worksheet, rowNumber, 7, previousRating.OverallEffectiveness.ToDisplayString(true)); SetTextCell(worksheet, rowNumber, 8, IsOfstedRatingBeforeOrAfterJoining( previousRating.OverallEffectiveness, @@ -139,7 +139,7 @@ private static void GenerateAcademyRow( SetDateCell(worksheet, rowNumber, 9, previousRating.InspectionDate); - SetTextCell(worksheet, rowNumber, 10, currentRating.OverallEffectiveness.ToDisplayString()); + SetTextCell(worksheet, rowNumber, 10, currentRating.OverallEffectiveness.ToDisplayString(true)); SetTextCell(worksheet, rowNumber, 11, IsOfstedRatingBeforeOrAfterJoining( currentRating.OverallEffectiveness, @@ -257,12 +257,13 @@ private static void GenerateOfstedRow( ); // Current Ratings - SetTextCell(worksheet, rowNumber, 5, currentRating.QualityOfEducation.ToDisplayString()); - SetTextCell(worksheet, rowNumber, 6, currentRating.BehaviourAndAttitudes.ToDisplayString()); - SetTextCell(worksheet, rowNumber, 7, currentRating.PersonalDevelopment.ToDisplayString()); - SetTextCell(worksheet, rowNumber, 8, currentRating.EffectivenessOfLeadershipAndManagement.ToDisplayString()); - SetTextCell(worksheet, rowNumber, 9, currentRating.EarlyYearsProvision.ToDisplayString()); - SetTextCell(worksheet, rowNumber, 10, currentRating.SixthFormProvision.ToDisplayString()); + SetTextCell(worksheet, rowNumber, 5, currentRating.QualityOfEducation.ToDisplayString(true)); + SetTextCell(worksheet, rowNumber, 6, currentRating.BehaviourAndAttitudes.ToDisplayString(true)); + SetTextCell(worksheet, rowNumber, 7, currentRating.PersonalDevelopment.ToDisplayString(true)); + SetTextCell(worksheet, rowNumber, 8, + currentRating.EffectivenessOfLeadershipAndManagement.ToDisplayString(true)); + SetTextCell(worksheet, rowNumber, 9, currentRating.EarlyYearsProvision.ToDisplayString(true)); + SetTextCell(worksheet, rowNumber, 10, currentRating.SixthFormProvision.ToDisplayString(true)); // Previous Inspection Date SetDateCell(worksheet, rowNumber, 11, previousRating.InspectionDate); @@ -276,14 +277,14 @@ private static void GenerateOfstedRow( ) ); - // Previous Ratings - SetTextCell(worksheet, rowNumber, 13, previousRating.QualityOfEducation.ToDisplayString()); - SetTextCell(worksheet, rowNumber, 14, previousRating.BehaviourAndAttitudes.ToDisplayString()); - SetTextCell(worksheet, rowNumber, 15, previousRating.PersonalDevelopment.ToDisplayString()); - SetTextCell(worksheet, rowNumber, 16, previousRating.EffectivenessOfLeadershipAndManagement.ToDisplayString()); - SetTextCell(worksheet, rowNumber, 17, previousRating.EarlyYearsProvision.ToDisplayString()); - SetTextCell(worksheet, rowNumber, 18, previousRating.SixthFormProvision.ToDisplayString()); - + // Previous Ratings - Note, setting "current rating" as true so spreadsheet content doesn't change due to single headline grades implementation + SetTextCell(worksheet, rowNumber, 13, previousRating.QualityOfEducation.ToDisplayString(true)); + SetTextCell(worksheet, rowNumber, 14, previousRating.BehaviourAndAttitudes.ToDisplayString(true)); + SetTextCell(worksheet, rowNumber, 15, previousRating.PersonalDevelopment.ToDisplayString(true)); + SetTextCell(worksheet, rowNumber, 16, + previousRating.EffectivenessOfLeadershipAndManagement.ToDisplayString(true)); + SetTextCell(worksheet, rowNumber, 17, previousRating.EarlyYearsProvision.ToDisplayString(true)); + SetTextCell(worksheet, rowNumber, 18, previousRating.SixthFormProvision.ToDisplayString(true)); // Safeguarding Effective SetTextCell(worksheet, rowNumber, 19, currentRating.SafeguardingIsEffective.ToDisplayString()); diff --git a/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Extensions/OfstedRatingScoreExtensionsTests.cs b/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Extensions/OfstedRatingScoreExtensionsTests.cs index 34405db32..5ac9ac7ef 100644 --- a/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Extensions/OfstedRatingScoreExtensionsTests.cs +++ b/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Extensions/OfstedRatingScoreExtensionsTests.cs @@ -6,37 +6,33 @@ namespace DfE.FindInformationAcademiesTrusts.UnitTests.Extensions; public class OfstedRatingScoreExtensionsTests { [Theory] - [InlineData(OfstedRatingScore.Outstanding, "Outstanding")] - [InlineData(OfstedRatingScore.Good, "Good")] - [InlineData(OfstedRatingScore.RequiresImprovement, "Requires improvement")] - [InlineData(OfstedRatingScore.Inadequate, "Inadequate")] - [InlineData(OfstedRatingScore.InsufficientEvidence, "Insufficient evidence")] - [InlineData(OfstedRatingScore.NoJudgement, "No judgement")] - [InlineData(OfstedRatingScore.DoesNotApply, "Does not apply")] - [InlineData(OfstedRatingScore.NotInspected, "Not yet inspected")] - public void ToDisplayString_ReturnsCorrectString_ForDefinedEnumValues(OfstedRatingScore rating, string expected) + [InlineData(OfstedRatingScore.Outstanding, "Outstanding", true)] + [InlineData(OfstedRatingScore.Outstanding, "Outstanding", false)] + [InlineData(OfstedRatingScore.Good, "Good", true)] + [InlineData(OfstedRatingScore.Good, "Good", false)] + [InlineData(OfstedRatingScore.RequiresImprovement, "Requires improvement", true)] + [InlineData(OfstedRatingScore.RequiresImprovement, "Requires improvement", false)] + [InlineData(OfstedRatingScore.Inadequate, "Inadequate", true)] + [InlineData(OfstedRatingScore.Inadequate, "Inadequate", false)] + [InlineData(OfstedRatingScore.InsufficientEvidence, "Insufficient evidence", true)] + [InlineData(OfstedRatingScore.InsufficientEvidence, "Insufficient evidence", false)] + [InlineData(OfstedRatingScore.NoJudgement, "No judgement", true)] + [InlineData(OfstedRatingScore.NoJudgement, "No judgement", false)] + [InlineData(OfstedRatingScore.DoesNotApply, "Does not apply", true)] + [InlineData(OfstedRatingScore.DoesNotApply, "Does not apply", false)] + [InlineData(OfstedRatingScore.NotInspected, "Not yet inspected", true)] + [InlineData(OfstedRatingScore.NotInspected, "Not inspected", false)] + [InlineData((OfstedRatingScore)999, "Unknown", true)] + [InlineData((OfstedRatingScore)999, "Unknown", false)] + public void ToDisplayString_ReturnsCorrectString(OfstedRatingScore rating, string expected, bool isCurrent) { // Act - var result = rating.ToDisplayString(); + var result = rating.ToDisplayString(isCurrent); // Assert result.Should().Be(expected); } - [Fact] - public void ToDisplayString_ReturnsUnknown_ForUndefinedEnumValue() - { - // Arrange - // Cast an undefined integer value to the enum - var undefinedRating = (OfstedRatingScore)999; - - // Act - var result = undefinedRating.ToDisplayString(); - - // Assert - result.Should().Be("Unknown"); - } - [Theory] [InlineData(OfstedRatingScore.Outstanding, 1)] [InlineData(OfstedRatingScore.Good, 2)] From 478494430c9cd1da11d82b5b205ba677d42747ee Mon Sep 17 00:00:00 2001 From: Sara Gowen <9001998+dynamictulip@users.noreply.github.com> Date: Fri, 24 Jan 2025 15:43:45 +0000 Subject: [PATCH 04/21] Style single headline grade cells Add space between grade and before/after tag --- .../Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml | 6 ++---- .../assets/sass/components/_table.scss | 7 +++++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml index 698967f8b..15addcf5b 100644 --- a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml +++ b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml @@ -41,17 +41,15 @@ @academy.DateAcademyJoinedTrust.ToString(StringFormatConstants.DisplayDateFormat) - + @academy.CurrentOfstedRating.OverallEffectiveness.ToDisplayString(true) -
@academy.CurrentOfstedRating.InspectionDate.ShowDateStringOrReplaceWithText() - + @academy.PreviousOfstedRating.OverallEffectiveness.ToDisplayString(false) -
diff --git a/DfE.FindInformationAcademiesTrusts/assets/sass/components/_table.scss b/DfE.FindInformationAcademiesTrusts/assets/sass/components/_table.scss index bfce6333f..fb2c0c93e 100644 --- a/DfE.FindInformationAcademiesTrusts/assets/sass/components/_table.scss +++ b/DfE.FindInformationAcademiesTrusts/assets/sass/components/_table.scss @@ -31,4 +31,11 @@ .column-header-ofsted-rating { width: 10%; } + + .cell-ofsted-single-headline-grade { + .govuk-tag { + margin-top: 10px; + margin-bottom: 7px; + } + } } From 7904f5fc6b2a8125ba975aa86255b314ed23673a Mon Sep 17 00:00:00 2001 From: Sara Gowen <9001998+dynamictulip@users.noreply.github.com> Date: Fri, 24 Jan 2025 16:35:53 +0000 Subject: [PATCH 05/21] Move single headline grade to partial This enables code reuse and also showing the relevant "not inspected"/"not yet inspected" in the inspection date. --- .../Trusts/Ofsted/SingleHeadlineGrades.cshtml | 17 ++----------- .../Ofsted/_SingleHeadlineGradeCells.cshtml | 24 +++++++++++++++++++ .../_SingleHeadlineGradeCells.cshtml.cs | 12 ++++++++++ 3 files changed, 38 insertions(+), 15 deletions(-) create mode 100644 DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml create mode 100644 DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml.cs diff --git a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml index 15addcf5b..f57347fdc 100644 --- a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml +++ b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml @@ -1,5 +1,4 @@ @page "/trusts/ofsted/single-headline-grades" -@using DfE.FindInformationAcademiesTrusts.Extensions @model SingleHeadlineGradesModel @{ @@ -41,20 +40,8 @@ @academy.DateAcademyJoinedTrust.ToString(StringFormatConstants.DisplayDateFormat) - - @academy.CurrentOfstedRating.OverallEffectiveness.ToDisplayString(true) - - - - @academy.CurrentOfstedRating.InspectionDate.ShowDateStringOrReplaceWithText() - - - @academy.PreviousOfstedRating.OverallEffectiveness.ToDisplayString(false) - - - - @academy.PreviousOfstedRating.InspectionDate.ShowDateStringOrReplaceWithText() - + + } diff --git a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml new file mode 100644 index 000000000..fd6d69d7a --- /dev/null +++ b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml @@ -0,0 +1,24 @@ +@using DfE.FindInformationAcademiesTrusts.Data +@using DfE.FindInformationAcademiesTrusts.Extensions +@using Microsoft.AspNetCore.Mvc.TagHelpers +@model SingleHeadlineGradeCellsModel + +@if (Model.SingleHeadlineGradeRating.OverallEffectiveness == OfstedRatingScore.NotInspected) +{ + + @OfstedRatingScore.NotInspected.ToDisplayString(Model.IsCurrent) + + + @OfstedRatingScore.NotInspected.ToDisplayString(Model.IsCurrent) + +} +else +{ + + @Model.SingleHeadlineGradeRating.OverallEffectiveness.ToDisplayString(Model.IsCurrent) + + + + @Model.SingleHeadlineGradeRating.InspectionDate.ShowDateStringOrReplaceWithText() + +} diff --git a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml.cs b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml.cs new file mode 100644 index 000000000..f5bfe85d5 --- /dev/null +++ b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml.cs @@ -0,0 +1,12 @@ +using DfE.FindInformationAcademiesTrusts.Data; +using DfE.FindInformationAcademiesTrusts.Data.Enums; + +namespace DfE.FindInformationAcademiesTrusts.Pages.Trusts.Ofsted; + +public record SingleHeadlineGradeCellsModel( + OfstedRating SingleHeadlineGradeRating, + BeforeOrAfterJoining BeforeOrAfterJoining, + bool IsCurrent) +{ + public BeforeOrAfterTagModel BeforeOrAfterTagModel { get; } = new(BeforeOrAfterJoining, IsCurrent); +} From 4fba1551a15e0974a9b3a7e5e0dda5c988ac9964 Mon Sep 17 00:00:00 2001 From: Sara Gowen <9001998+dynamictulip@users.noreply.github.com> Date: Mon, 27 Jan 2025 10:11:02 +0000 Subject: [PATCH 06/21] Add Details component "Why a single headline grade might not be available" --- .../Trusts/Ofsted/SingleHeadlineGrades.cshtml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml index f57347fdc..c96522e0e 100644 --- a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml +++ b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml @@ -6,6 +6,24 @@ }
+
+ + + Why a single headline grade might not be available + + +
+

+ Single headline grades stopped being awarded by Ofsted on 2 September 2024. +

+

+ Inspections completed after this date are broken down by category. +

+

+ You can see these on the ‘Current ratings’ and ‘Previous ratings’ pages. +

+
+
From 2d060c83c403eaed843ea52f30b01891ad8eefef Mon Sep 17 00:00:00 2001 From: Sara Gowen <9001998+dynamictulip@users.noreply.github.com> Date: Mon, 27 Jan 2025 10:57:57 +0000 Subject: [PATCH 07/21] Amend vertical padding on Ofsted pages This is following a review with Design --- .../Pages/Trusts/Ofsted/CurrentRatings.cshtml | 2 +- .../Pages/Trusts/Ofsted/PreviousRatings.cshtml | 2 +- .../Pages/Trusts/Ofsted/SafeguardingAndConcerns.cshtml | 5 ++--- .../Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml | 3 ++- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/CurrentRatings.cshtml b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/CurrentRatings.cshtml index c1616ccff..02a17d8ad 100644 --- a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/CurrentRatings.cshtml +++ b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/CurrentRatings.cshtml @@ -6,7 +6,7 @@ Layout = "Ofsted/_OfstedLayout"; } -
+
Single headline grades
diff --git a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/PreviousRatings.cshtml b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/PreviousRatings.cshtml index c80423064..1f93a657e 100644 --- a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/PreviousRatings.cshtml +++ b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/PreviousRatings.cshtml @@ -6,7 +6,7 @@ Layout = "Ofsted/_OfstedLayout"; } -
+
Current ratings
diff --git a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SafeguardingAndConcerns.cshtml b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SafeguardingAndConcerns.cshtml index ea3ed3867..7eeb4a6b3 100644 --- a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SafeguardingAndConcerns.cshtml +++ b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SafeguardingAndConcerns.cshtml @@ -6,7 +6,7 @@ Layout = "Ofsted/_OfstedLayout"; } -
+
@@ -14,16 +14,15 @@
-

'Effective safeguarding' means that a school has been judged to have adequate safeguarding policies and processes in place. It reviews them regularly and implements them well.

'Category of concern' means that a school has been found inadequate in a key or provision judgement. The school either has ‘serious weaknesses’ or requires ‘special measures’.

-
+
Previous ratings
diff --git a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml index c96522e0e..fbf4fc8f9 100644 --- a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml +++ b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml @@ -5,7 +5,7 @@ Layout = "Ofsted/_OfstedLayout"; } -
+
@@ -24,6 +24,7 @@

+
Safeguarding and concerns
From 63a8ba596e3252528f98fd2e4ccece8850ceddef Mon Sep 17 00:00:00 2001 From: Sara Gowen <9001998+dynamictulip@users.noreply.github.com> Date: Mon, 27 Jan 2025 16:04:35 +0000 Subject: [PATCH 08/21] Add single headline grade display logic Moved logic into the cs model where possible so it can be unit tested --- .../Trusts/Ofsted/SingleHeadlineGrades.cshtml | 4 +- .../Ofsted/_SingleHeadlineGradeCells.cshtml | 39 ++-- .../_SingleHeadlineGradeCells.cshtml.cs | 32 ++- .../SingleHeadlineGradeCellsModelTests.cs | 195 ++++++++++++++++++ 4 files changed, 245 insertions(+), 25 deletions(-) create mode 100644 tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/Ofsted/SingleHeadlineGradeCellsModelTests.cs diff --git a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml index fbf4fc8f9..ddf865358 100644 --- a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml +++ b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/SingleHeadlineGrades.cshtml @@ -35,13 +35,13 @@ - - - -} -else -{ - - -} +@* Single headline grade *@ + + +@* Inspection date *@ + diff --git a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml.cs b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml.cs index f5bfe85d5..c56e73864 100644 --- a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml.cs +++ b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml.cs @@ -1,5 +1,6 @@ using DfE.FindInformationAcademiesTrusts.Data; using DfE.FindInformationAcademiesTrusts.Data.Enums; +using DfE.FindInformationAcademiesTrusts.Extensions; namespace DfE.FindInformationAcademiesTrusts.Pages.Trusts.Ofsted; @@ -8,5 +9,34 @@ public record SingleHeadlineGradeCellsModel( BeforeOrAfterJoining BeforeOrAfterJoining, bool IsCurrent) { - public BeforeOrAfterTagModel BeforeOrAfterTagModel { get; } = new(BeforeOrAfterJoining, IsCurrent); + public bool HasInspection => SingleHeadlineGradeRating.OverallEffectiveness != OfstedRatingScore.NotInspected; + + public string TagLabel => BeforeOrAfterJoining switch + { + BeforeOrAfterJoining.Before => "Before joining", + BeforeOrAfterJoining.After => "After joining", + _ => "Unknown" + }; + + public bool IsBeforeJoining => BeforeOrAfterJoining == BeforeOrAfterJoining.Before; + + public bool RatingShouldBeBold => SingleHeadlineGradeRating.OverallEffectiveness switch + { + OfstedRatingScore.Outstanding + or OfstedRatingScore.Good + or OfstedRatingScore.RequiresImprovement + or OfstedRatingScore.Inadequate => true, + _ => false + }; + + public string InspectionDateText => HasInspection + ? SingleHeadlineGradeRating.InspectionDate.ShowDateStringOrReplaceWithText() + : OfstedRatingScore.NotInspected.ToDisplayString(IsCurrent); + + public string InspectionDateSort => + SingleHeadlineGradeRating.InspectionDate?.ToString(StringFormatConstants.SortableDateFormat) + ?? "0"; + + public string SingleHeadlineGradeText => SingleHeadlineGradeRating.OverallEffectiveness.ToDisplayString(IsCurrent); + public int SingleHeadlineGradeSort => SingleHeadlineGradeRating.OverallEffectiveness.ToDataSortValue(); } diff --git a/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/Ofsted/SingleHeadlineGradeCellsModelTests.cs b/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/Ofsted/SingleHeadlineGradeCellsModelTests.cs new file mode 100644 index 000000000..6dad1da23 --- /dev/null +++ b/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/Ofsted/SingleHeadlineGradeCellsModelTests.cs @@ -0,0 +1,195 @@ +using DfE.FindInformationAcademiesTrusts.Data; +using DfE.FindInformationAcademiesTrusts.Data.Enums; +using DfE.FindInformationAcademiesTrusts.Pages.Trusts.Ofsted; + +namespace DfE.FindInformationAcademiesTrusts.UnitTests.Pages.Trusts.Ofsted; + +public class SingleHeadlineGradeCellsModelTests +{ + private readonly SingleHeadlineGradeCellsModel _singleHeadlineGradeCellsModel = + new(GetOfstedRatingWith(OfstedRatingScore.Good), BeforeOrAfterJoining.After, true); + + private static OfstedRating GetOfstedRatingWith(OfstedRatingScore singleHeadlineGradeRating) + { + return GetOfstedRatingWith(singleHeadlineGradeRating, new DateTime(2022, 02, 25)); + } + + private static OfstedRating GetOfstedRatingWith(OfstedRatingScore singleHeadlineGradeRating, + DateTime inspectionDate) + { + return singleHeadlineGradeRating switch + { + OfstedRatingScore.Unknown => OfstedRating.Unknown, + OfstedRatingScore.NotInspected => OfstedRating.NotInspected, + _ => new OfstedRating(singleHeadlineGradeRating, OfstedRatingScore.Good, OfstedRatingScore.Good, + OfstedRatingScore.Good, OfstedRatingScore.Good, OfstedRatingScore.Good, OfstedRatingScore.Good, + CategoriesOfConcern.NoConcerns, SafeguardingScore.Yes, inspectionDate) + }; + } + + [Fact] + public void HasInspection_should_return_false_when_not_inspected() + { + var sut = _singleHeadlineGradeCellsModel with + { + SingleHeadlineGradeRating = OfstedRating.NotInspected + }; + + sut.HasInspection.Should().BeFalse(); + } + + [Theory] + [InlineData(OfstedRatingScore.Outstanding)] + [InlineData(OfstedRatingScore.Good)] + [InlineData(OfstedRatingScore.RequiresImprovement)] + [InlineData(OfstedRatingScore.Inadequate)] + [InlineData(OfstedRatingScore.NoJudgement)] + public void HasInspection_should_return_true_when_inspected(OfstedRatingScore overallEffectiveness) + { + var sut = _singleHeadlineGradeCellsModel with + { + SingleHeadlineGradeRating = GetOfstedRatingWith(overallEffectiveness) + }; + + sut.HasInspection.Should().BeTrue(); + } + + [Theory] + [InlineData(BeforeOrAfterJoining.Before, "Before joining")] + [InlineData(BeforeOrAfterJoining.After, "After joining")] + [InlineData(BeforeOrAfterJoining.NotYetInspected, "Unknown")] + [InlineData((BeforeOrAfterJoining)999, "Unknown")] + public void TagLabel_should_return_expected_label_for_BeforeOrAfterJoining(BeforeOrAfterJoining beforeOrAfter, + string expected) + { + var sut = _singleHeadlineGradeCellsModel with + { + BeforeOrAfterJoining = beforeOrAfter + }; + + sut.TagLabel.Should().Be(expected); + } + + [Theory] + [InlineData(BeforeOrAfterJoining.Before, true)] + [InlineData(BeforeOrAfterJoining.After, false)] + [InlineData(BeforeOrAfterJoining.NotYetInspected, false)] + [InlineData((BeforeOrAfterJoining)999, false)] + public void IsBeforeJoining_should_return_expected_bool_for_BeforeOrAfterJoining(BeforeOrAfterJoining beforeOrAfter, + bool expected) + { + var sut = _singleHeadlineGradeCellsModel with + { + BeforeOrAfterJoining = beforeOrAfter + }; + + sut.IsBeforeJoining.Should().Be(expected); + } + + [Theory] + [InlineData(OfstedRatingScore.Outstanding)] + [InlineData(OfstedRatingScore.Good)] + [InlineData(OfstedRatingScore.RequiresImprovement)] + [InlineData(OfstedRatingScore.Inadequate)] + public void RatingShouldBeBold_should_return_true_when_valid_shg(OfstedRatingScore overallEffectiveness) + { + var sut = _singleHeadlineGradeCellsModel with + { + SingleHeadlineGradeRating = GetOfstedRatingWith(overallEffectiveness) + }; + + sut.RatingShouldBeBold.Should().BeTrue(); + } + + [Theory] + [InlineData(OfstedRatingScore.NotInspected)] + [InlineData(OfstedRatingScore.Unknown)] + [InlineData(OfstedRatingScore.NoJudgement)] + public void RatingShouldBeBold_should_return_false_when_no_shg(OfstedRatingScore overallEffectiveness) + { + var sut = _singleHeadlineGradeCellsModel with + { + SingleHeadlineGradeRating = GetOfstedRatingWith(overallEffectiveness) + }; + + sut.RatingShouldBeBold.Should().BeFalse(); + } + + [Theory] + [InlineData(true, "Not yet inspected")] + [InlineData(false, "Not inspected")] + public void InspectionDateText_should_return_not_inspected_when_no_inspection(bool isCurrent, string expected) + { + var sut = _singleHeadlineGradeCellsModel with + { + SingleHeadlineGradeRating = OfstedRating.NotInspected, + IsCurrent = isCurrent + }; + + sut.InspectionDateText.Should().Be(expected); + } + + [Fact] + public void InspectionDateText_should_return_date_when_has_inspection() + { + var sut = _singleHeadlineGradeCellsModel with + { + SingleHeadlineGradeRating = GetOfstedRatingWith(OfstedRatingScore.Good, new DateTime(2023, 10, 23)) + }; + + sut.InspectionDateText.Should().Be("23 Oct 2023"); + } + + [Fact] + public void InspectionDateSort_should_return_not_inspected_when_no_inspection() + { + var sut = _singleHeadlineGradeCellsModel with + { + SingleHeadlineGradeRating = OfstedRating.NotInspected + }; + + sut.InspectionDateSort.Should().Be("0"); + } + + [Fact] + public void InspectionDateSort_should_return_date_when_has_inspection() + { + var sut = _singleHeadlineGradeCellsModel with + { + SingleHeadlineGradeRating = GetOfstedRatingWith(OfstedRatingScore.Good, new DateTime(2023, 10, 23)) + }; + + sut.InspectionDateSort.Should().Be("20231023"); + } + + [Theory] + [InlineData(OfstedRatingScore.NotInspected, true, "Not yet inspected")] + [InlineData(OfstedRatingScore.NotInspected, false, "Not inspected")] + [InlineData(OfstedRatingScore.Outstanding, true, "Outstanding")] + [InlineData(OfstedRatingScore.Good, false, "Good")] + public void SingleHeadlineGradeText_should_return_ToDisplayString(OfstedRatingScore ofstedRatingScore, + bool isCurrent, string expected) + { + var sut = _singleHeadlineGradeCellsModel with + { + SingleHeadlineGradeRating = GetOfstedRatingWith(ofstedRatingScore), + IsCurrent = isCurrent + }; + + sut.SingleHeadlineGradeText.Should().Be(expected); + } + + [Theory] + [InlineData(OfstedRatingScore.NotInspected, 8)] + [InlineData(OfstedRatingScore.Outstanding, 1)] + [InlineData(OfstedRatingScore.Good, 2)] + public void SingleHeadlineGradeSort_should_return_ToDataSortValue(OfstedRatingScore ofstedRatingScore, int expected) + { + var sut = _singleHeadlineGradeCellsModel with + { + SingleHeadlineGradeRating = GetOfstedRatingWith(ofstedRatingScore) + }; + + sut.SingleHeadlineGradeSort.Should().Be(expected); + } +} From a0b76dc231a4811a76a213f24a2f57ef6425a041 Mon Sep 17 00:00:00 2001 From: Linzi CARLIN Date: Mon, 27 Jan 2025 16:36:48 +0000 Subject: [PATCH 09/21] Update spreadsheet not inspected rating to be consistent with ofsted tables --- .../Services/Export/ExportService.cs | 16 ++++++++-------- .../Services/ExportServiceTests.cs | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/DfE.FindInformationAcademiesTrusts/Services/Export/ExportService.cs b/DfE.FindInformationAcademiesTrusts/Services/Export/ExportService.cs index 85f11c1dd..a0f374f6a 100644 --- a/DfE.FindInformationAcademiesTrusts/Services/Export/ExportService.cs +++ b/DfE.FindInformationAcademiesTrusts/Services/Export/ExportService.cs @@ -128,7 +128,7 @@ private static void GenerateAcademyRow( SetDateCell(worksheet, rowNumber, 6, ofstedData?.DateAcademyJoinedTrust); - SetTextCell(worksheet, rowNumber, 7, previousRating.OverallEffectiveness.ToDisplayString(true)); + SetTextCell(worksheet, rowNumber, 7, previousRating.OverallEffectiveness.ToDisplayString(false)); SetTextCell(worksheet, rowNumber, 8, IsOfstedRatingBeforeOrAfterJoining( previousRating.OverallEffectiveness, @@ -277,14 +277,14 @@ private static void GenerateOfstedRow( ) ); - // Previous Ratings - Note, setting "current rating" as true so spreadsheet content doesn't change due to single headline grades implementation - SetTextCell(worksheet, rowNumber, 13, previousRating.QualityOfEducation.ToDisplayString(true)); - SetTextCell(worksheet, rowNumber, 14, previousRating.BehaviourAndAttitudes.ToDisplayString(true)); - SetTextCell(worksheet, rowNumber, 15, previousRating.PersonalDevelopment.ToDisplayString(true)); + // Previous Ratings + SetTextCell(worksheet, rowNumber, 13, previousRating.QualityOfEducation.ToDisplayString(false)); + SetTextCell(worksheet, rowNumber, 14, previousRating.BehaviourAndAttitudes.ToDisplayString(false)); + SetTextCell(worksheet, rowNumber, 15, previousRating.PersonalDevelopment.ToDisplayString(false)); SetTextCell(worksheet, rowNumber, 16, - previousRating.EffectivenessOfLeadershipAndManagement.ToDisplayString(true)); - SetTextCell(worksheet, rowNumber, 17, previousRating.EarlyYearsProvision.ToDisplayString(true)); - SetTextCell(worksheet, rowNumber, 18, previousRating.SixthFormProvision.ToDisplayString(true)); + previousRating.EffectivenessOfLeadershipAndManagement.ToDisplayString(false)); + SetTextCell(worksheet, rowNumber, 17, previousRating.EarlyYearsProvision.ToDisplayString(false)); + SetTextCell(worksheet, rowNumber, 18, previousRating.SixthFormProvision.ToDisplayString(false)); // Safeguarding Effective SetTextCell(worksheet, rowNumber, 19, currentRating.SafeguardingIsEffective.ToDisplayString()); diff --git a/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Services/ExportServiceTests.cs b/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Services/ExportServiceTests.cs index 0c7f48bd4..aac10fc45 100644 --- a/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Services/ExportServiceTests.cs +++ b/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Services/ExportServiceTests.cs @@ -98,7 +98,7 @@ public async Task ExportAcademiesToSpreadsheet_ShouldCorrectlyExtractAcademyData worksheet.Cell(4, 6).DataType.Should().Be(ClosedXML.Excel.XLDataType.DateTime); worksheet.Cell(4, 6).GetValue().Should().BeCloseTo(now, TimeSpan.FromSeconds(1)); - worksheet.Cell(4, 7).Value.ToString().Should().Be("Not yet inspected"); + worksheet.Cell(4, 7).Value.ToString().Should().Be("Not inspected"); worksheet.Cell(4, 8).Value.ToString().Should().Be(string.Empty); worksheet.Cell(4, 9).Value.ToString().Should().Be(string.Empty); worksheet.Cell(4, 10).Value.ToString().Should().Be("Outstanding"); @@ -176,7 +176,7 @@ public async Task ExportAcademiesToSpreadsheet_ShouldCorrectlyHandleNullValuesAs worksheet.Cell(4, 6).DataType.Should().Be(XLDataType.DateTime); worksheet.Cell(4, 6).GetValue().Should().BeCloseTo(now, TimeSpan.FromSeconds(1)); - worksheet.Cell(4, 7).Value.ToString().Should().Be("Not yet inspected"); + worksheet.Cell(4, 7).Value.ToString().Should().Be("Not inspected"); worksheet.Cell(4, 8).Value.ToString().Should().Be(string.Empty); worksheet.Cell(4, 9).Value.ToString().Should().Be(string.Empty); worksheet.Cell(4, 10).Value.ToString().Should().Be("Not yet inspected"); @@ -293,7 +293,7 @@ public async Task ExportAcademiesToSpreadsheet_ShouldHandleMissingOfstedDataAsyn using var workbook = new XLWorkbook(new MemoryStream(result)); var worksheet = workbook.Worksheet("Academies"); - worksheet.Cell(4, 7).Value.ToString().Should().Be("Not yet inspected"); + worksheet.Cell(4, 7).Value.ToString().Should().Be("Not inspected"); worksheet.Cell(4, 8).Value.ToString().Should().Be(string.Empty); worksheet.Cell(4, 9).Value.ToString().Should().Be(string.Empty); worksheet.Cell(4, 10).Value.ToString().Should().Be("Not yet inspected"); From 72f2db93aa67d2dabc2388283c1e644310e4a3af Mon Sep 17 00:00:00 2001 From: Sara Gowen <9001998+dynamictulip@users.noreply.github.com> Date: Tue, 28 Jan 2025 10:51:34 +0000 Subject: [PATCH 10/21] Rename `NoJudgement` to `SingleHeadlineGradeNotAvailable` Also change display text to "Not available" --- .../Repositories/AcademyRepository.cs | 2 +- .../OfstedRating.cs | 2 +- .../Extensions/OfstedRatingScoreExtensions.cs | 4 ++-- .../Repositories/AcademyRepositoryOfstedTests.cs | 11 ++++++----- .../Extensions/OfstedRatingScoreExtensionsTests.cs | 6 +++--- .../Ofsted/SingleHeadlineGradeCellsModelTests.cs | 4 ++-- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/DfE.FindInformationAcademiesTrusts.Data.AcademiesDb/Repositories/AcademyRepository.cs b/DfE.FindInformationAcademiesTrusts.Data.AcademiesDb/Repositories/AcademyRepository.cs index 81521287a..eb641f88e 100644 --- a/DfE.FindInformationAcademiesTrusts.Data.AcademiesDb/Repositories/AcademyRepository.cs +++ b/DfE.FindInformationAcademiesTrusts.Data.AcademiesDb/Repositories/AcademyRepository.cs @@ -211,7 +211,7 @@ public static OfstedRatingScore ConvertOverallEffectivenessToOfstedRatingScore(s // Check if it is 'Not judged' all other gradings are int based if (rating?.ToLower().Equals("not judged") ?? false) { - return OfstedRatingScore.NoJudgement; + return OfstedRatingScore.SingleHeadlineGradeNotAvailable; } return ConvertNullableStringToOfstedRatingScore(rating); diff --git a/DfE.FindInformationAcademiesTrusts.Data/OfstedRating.cs b/DfE.FindInformationAcademiesTrusts.Data/OfstedRating.cs index e23a506c6..c8f074aab 100644 --- a/DfE.FindInformationAcademiesTrusts.Data/OfstedRating.cs +++ b/DfE.FindInformationAcademiesTrusts.Data/OfstedRating.cs @@ -58,7 +58,7 @@ public enum OfstedRatingScore RequiresImprovement = 3, Inadequate = 4, DoesNotApply = 8, - NoJudgement = 9 + SingleHeadlineGradeNotAvailable = 9 } public enum SafeguardingScore diff --git a/DfE.FindInformationAcademiesTrusts/Extensions/OfstedRatingScoreExtensions.cs b/DfE.FindInformationAcademiesTrusts/Extensions/OfstedRatingScoreExtensions.cs index 489edf81d..cb398cfdc 100644 --- a/DfE.FindInformationAcademiesTrusts/Extensions/OfstedRatingScoreExtensions.cs +++ b/DfE.FindInformationAcademiesTrusts/Extensions/OfstedRatingScoreExtensions.cs @@ -13,7 +13,7 @@ public static int ToDataSortValue(this OfstedRatingScore rating) OfstedRatingScore.RequiresImprovement => 3, OfstedRatingScore.Inadequate => 4, OfstedRatingScore.InsufficientEvidence => 5, - OfstedRatingScore.NoJudgement => 6, + OfstedRatingScore.SingleHeadlineGradeNotAvailable => 6, OfstedRatingScore.DoesNotApply => 7, OfstedRatingScore.NotInspected => 8, _ => -1 @@ -29,7 +29,7 @@ public static string ToDisplayString(this OfstedRatingScore rating, bool isCurre (OfstedRatingScore.RequiresImprovement, _) => "Requires improvement", (OfstedRatingScore.Inadequate, _) => "Inadequate", (OfstedRatingScore.InsufficientEvidence, _) => "Insufficient evidence", - (OfstedRatingScore.NoJudgement, _) => "No judgement", + (OfstedRatingScore.SingleHeadlineGradeNotAvailable, _) => "Not available", (OfstedRatingScore.DoesNotApply, _) => "Does not apply", (OfstedRatingScore.NotInspected, true) => "Not yet inspected", (OfstedRatingScore.NotInspected, false) => "Not inspected", diff --git a/tests/DfE.FindInformationAcademiesTrusts.Data.AcademiesDb.UnitTests/Repositories/AcademyRepositoryOfstedTests.cs b/tests/DfE.FindInformationAcademiesTrusts.Data.AcademiesDb.UnitTests/Repositories/AcademyRepositoryOfstedTests.cs index 779e738a8..80e6c003d 100644 --- a/tests/DfE.FindInformationAcademiesTrusts.Data.AcademiesDb.UnitTests/Repositories/AcademyRepositoryOfstedTests.cs +++ b/tests/DfE.FindInformationAcademiesTrusts.Data.AcademiesDb.UnitTests/Repositories/AcademyRepositoryOfstedTests.cs @@ -567,7 +567,7 @@ public void var result = AcademyRepository.ConvertOverallEffectivenessToOfstedRatingScore(rating); // Assert - result.Should().Be(OfstedRatingScore.NoJudgement); + result.Should().Be(OfstedRatingScore.SingleHeadlineGradeNotAvailable); } [Theory] @@ -576,7 +576,7 @@ public void [InlineData("3", OfstedRatingScore.RequiresImprovement)] [InlineData("4", OfstedRatingScore.Inadequate)] [InlineData("8", OfstedRatingScore.DoesNotApply)] - [InlineData("9", OfstedRatingScore.NoJudgement)] + [InlineData("9", OfstedRatingScore.SingleHeadlineGradeNotAvailable)] [InlineData("0", OfstedRatingScore.InsufficientEvidence)] [InlineData("-1", OfstedRatingScore.NotInspected)] public void @@ -625,11 +625,12 @@ public void ConvertOverallEffectivenessToOfstedRatingScore_Should_Return_Unknown [Theory] [InlineData("1", "2", OfstedRatingScore.Outstanding, OfstedRatingScore.Good)] - [InlineData("Not judged", "Not judged", OfstedRatingScore.NoJudgement, OfstedRatingScore.NoJudgement)] + [InlineData("Not judged", "Not judged", OfstedRatingScore.SingleHeadlineGradeNotAvailable, + OfstedRatingScore.SingleHeadlineGradeNotAvailable)] [InlineData(null, null, OfstedRatingScore.NotInspected, OfstedRatingScore.NotInspected)] [InlineData("abc", "def", OfstedRatingScore.Unknown, OfstedRatingScore.Unknown)] - [InlineData("2", "Not judged", OfstedRatingScore.Good, OfstedRatingScore.NoJudgement)] - [InlineData("Not judged", "1", OfstedRatingScore.NoJudgement, OfstedRatingScore.Outstanding)] + [InlineData("2", "Not judged", OfstedRatingScore.Good, OfstedRatingScore.SingleHeadlineGradeNotAvailable)] + [InlineData("Not judged", "1", OfstedRatingScore.SingleHeadlineGradeNotAvailable, OfstedRatingScore.Outstanding)] public async Task GetAcademiesInTrustOfstedAsync_should_correctly_convert_OverallEffectiveness_and_PreviousFullInspectionOverallEffectiveness( string? overallEffectiveness, diff --git a/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Extensions/OfstedRatingScoreExtensionsTests.cs b/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Extensions/OfstedRatingScoreExtensionsTests.cs index 5ac9ac7ef..d1338f666 100644 --- a/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Extensions/OfstedRatingScoreExtensionsTests.cs +++ b/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Extensions/OfstedRatingScoreExtensionsTests.cs @@ -16,8 +16,8 @@ public class OfstedRatingScoreExtensionsTests [InlineData(OfstedRatingScore.Inadequate, "Inadequate", false)] [InlineData(OfstedRatingScore.InsufficientEvidence, "Insufficient evidence", true)] [InlineData(OfstedRatingScore.InsufficientEvidence, "Insufficient evidence", false)] - [InlineData(OfstedRatingScore.NoJudgement, "No judgement", true)] - [InlineData(OfstedRatingScore.NoJudgement, "No judgement", false)] + [InlineData(OfstedRatingScore.SingleHeadlineGradeNotAvailable, "Not available", true)] + [InlineData(OfstedRatingScore.SingleHeadlineGradeNotAvailable, "Not available", false)] [InlineData(OfstedRatingScore.DoesNotApply, "Does not apply", true)] [InlineData(OfstedRatingScore.DoesNotApply, "Does not apply", false)] [InlineData(OfstedRatingScore.NotInspected, "Not yet inspected", true)] @@ -39,7 +39,7 @@ public void ToDisplayString_ReturnsCorrectString(OfstedRatingScore rating, strin [InlineData(OfstedRatingScore.RequiresImprovement, 3)] [InlineData(OfstedRatingScore.Inadequate, 4)] [InlineData(OfstedRatingScore.InsufficientEvidence, 5)] - [InlineData(OfstedRatingScore.NoJudgement, 6)] + [InlineData(OfstedRatingScore.SingleHeadlineGradeNotAvailable, 6)] [InlineData(OfstedRatingScore.DoesNotApply, 7)] [InlineData(OfstedRatingScore.NotInspected, 8)] public void ToDataSortValue_ReturnsCorrectValue_ForDefinedEnumValues(OfstedRatingScore rating, int expected) diff --git a/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/Ofsted/SingleHeadlineGradeCellsModelTests.cs b/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/Ofsted/SingleHeadlineGradeCellsModelTests.cs index 6dad1da23..eeacf782d 100644 --- a/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/Ofsted/SingleHeadlineGradeCellsModelTests.cs +++ b/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/Ofsted/SingleHeadlineGradeCellsModelTests.cs @@ -43,7 +43,7 @@ public void HasInspection_should_return_false_when_not_inspected() [InlineData(OfstedRatingScore.Good)] [InlineData(OfstedRatingScore.RequiresImprovement)] [InlineData(OfstedRatingScore.Inadequate)] - [InlineData(OfstedRatingScore.NoJudgement)] + [InlineData(OfstedRatingScore.SingleHeadlineGradeNotAvailable)] public void HasInspection_should_return_true_when_inspected(OfstedRatingScore overallEffectiveness) { var sut = _singleHeadlineGradeCellsModel with @@ -104,7 +104,7 @@ public void RatingShouldBeBold_should_return_true_when_valid_shg(OfstedRatingSco [Theory] [InlineData(OfstedRatingScore.NotInspected)] [InlineData(OfstedRatingScore.Unknown)] - [InlineData(OfstedRatingScore.NoJudgement)] + [InlineData(OfstedRatingScore.SingleHeadlineGradeNotAvailable)] public void RatingShouldBeBold_should_return_false_when_no_shg(OfstedRatingScore overallEffectiveness) { var sut = _singleHeadlineGradeCellsModel with From 827b5ff86c1ab512401216c59f15eed2323ab718 Mon Sep 17 00:00:00 2001 From: Sara Gowen <9001998+dynamictulip@users.noreply.github.com> Date: Tue, 28 Jan 2025 15:47:55 +0000 Subject: [PATCH 11/21] Ensure single headline grades are not used on inspections that occur on or after 2nd September 2024 The database should never contain this information but adding a failsafe in case of future data integrity issues --- .../Repositories/AcademyRepository.cs | 53 ++++ .../Mocks/MockAcademiesDbContext.cs | 15 +- .../AcademyRepositoryOfstedTests.cs | 240 +++++++++++++++++- .../Mocks/MockLogger.cs | 2 +- 4 files changed, 307 insertions(+), 3 deletions(-) diff --git a/DfE.FindInformationAcademiesTrusts.Data.AcademiesDb/Repositories/AcademyRepository.cs b/DfE.FindInformationAcademiesTrusts.Data.AcademiesDb/Repositories/AcademyRepository.cs index eb641f88e..b0c427b90 100644 --- a/DfE.FindInformationAcademiesTrusts.Data.AcademiesDb/Repositories/AcademyRepository.cs +++ b/DfE.FindInformationAcademiesTrusts.Data.AcademiesDb/Repositories/AcademyRepository.cs @@ -10,6 +10,9 @@ namespace DfE.FindInformationAcademiesTrusts.Data.AcademiesDb.Repositories; public class AcademyRepository(IAcademiesDbContext academiesDbContext, ILogger logger) : IAcademyRepository { + private static readonly DateTime + SingleHeadlineGradesPolicyChangeDate = new(2024, 09, 02, 0, 0, 0, DateTimeKind.Utc); + public async Task GetAcademiesInTrustDetailsAsync(string uid) { return await academiesDbContext.GiasGroupLinks @@ -138,9 +141,59 @@ await academiesDbContext.MisMstrFurtherEducationEstablishmentsFiat ofstedRating.Urn); } + // Ensure that there are no single headline grades after policy change on 2nd September 2024 + if (ofstedRatings.Any(rating => + HasSingleHeadlineGradeIssuedAfterPolicyChange(rating.Current) || + HasSingleHeadlineGradeIssuedAfterPolicyChange(rating.Previous))) + { + LogErrorForUrnsWithSingleHeadlineGradesAfterPolicyChange(ofstedRatings); + + ofstedRatings = RemoveSingleHeadlineGradesIssuedAfterPolicyChange(ofstedRatings); + } + return ofstedRatings.ToDictionary(o => o.Urn.ToString(), o => o); } + private void LogErrorForUrnsWithSingleHeadlineGradesAfterPolicyChange(List ofstedRatings) + { + foreach (var ofstedRating in ofstedRatings) + { + if (HasSingleHeadlineGradeIssuedAfterPolicyChange(ofstedRating.Current)) + { + logger.LogError( + "URN {Urn} has a current Ofsted single headline grade of {score} issued on {InspectionDate} which was after single headline grades stopped being issued on 2nd September. This could be a data integrity issue with the Ofsted data in Academies Db.", + ofstedRating.Urn, ofstedRating.Current.OverallEffectiveness, ofstedRating.Current.InspectionDate); + } + + if (HasSingleHeadlineGradeIssuedAfterPolicyChange(ofstedRating.Previous)) + { + logger.LogError( + "URN {Urn} has a previous Ofsted single headline grade of {score} issued on {InspectionDate} which was after single headline grades stopped being issued on 2nd September. This could be a data integrity issue with the Ofsted data in Academies Db.", + ofstedRating.Urn, ofstedRating.Previous.OverallEffectiveness, ofstedRating.Previous.InspectionDate); + } + } + } + + private static bool HasSingleHeadlineGradeIssuedAfterPolicyChange(OfstedRating rating) + { + return rating.InspectionDate >= SingleHeadlineGradesPolicyChangeDate && + rating.OverallEffectiveness != OfstedRatingScore.SingleHeadlineGradeNotAvailable; + } + + private static List RemoveSingleHeadlineGradesIssuedAfterPolicyChange( + List ratings) + { + return ratings.Select(rating => rating with + { + Current = HasSingleHeadlineGradeIssuedAfterPolicyChange(rating.Current) + ? rating.Current with { OverallEffectiveness = OfstedRatingScore.SingleHeadlineGradeNotAvailable } + : rating.Current, + Previous = HasSingleHeadlineGradeIssuedAfterPolicyChange(rating.Previous) + ? rating.Previous with { OverallEffectiveness = OfstedRatingScore.SingleHeadlineGradeNotAvailable } + : rating.Previous + }).ToList(); + } + public async Task GetAcademiesInTrustPupilNumbersAsync(string uid) { return await academiesDbContext.GiasGroupLinks diff --git a/tests/DfE.FindInformationAcademiesTrusts.Data.AcademiesDb.UnitTests/Mocks/MockAcademiesDbContext.cs b/tests/DfE.FindInformationAcademiesTrusts.Data.AcademiesDb.UnitTests/Mocks/MockAcademiesDbContext.cs index 29073c777..4b219c464 100644 --- a/tests/DfE.FindInformationAcademiesTrusts.Data.AcademiesDb.UnitTests/Mocks/MockAcademiesDbContext.cs +++ b/tests/DfE.FindInformationAcademiesTrusts.Data.AcademiesDb.UnitTests/Mocks/MockAcademiesDbContext.cs @@ -29,7 +29,8 @@ public MockAcademiesDbContext() { SetupMockDbContext(_giasGroupLinks, context => context.GiasGroupLinks); SetupMockDbContext(_misMstrEstablishmentFiat, context => context.MisMstrEstablishmentsFiat); - SetupMockDbContext(_misMstrFurtherEducationEstablishmentFiat, context => context.MisMstrFurtherEducationEstablishmentsFiat); + SetupMockDbContext(_misMstrFurtherEducationEstablishmentFiat, + context => context.MisMstrFurtherEducationEstablishmentsFiat); SetupMockDbContext(_cdmSystemusers, context => context.CdmSystemusers); SetupMockDbContext(_cdmAccounts, context => context.CdmAccounts); SetupMockDbContext(_giasGroups, context => context.Groups); @@ -118,6 +119,11 @@ public void AddEstablishmentFiat(int urn, string? inspectionStartDate = null) }); } + public void AddEstablishmentsFiat(params MisMstrEstablishmentFiat[] establishmentsFiat) + { + AddEstablishmentsFiat((IEnumerable)establishmentsFiat); + } + public void AddEstablishmentsFiat(IEnumerable establishmentsFiat) { _misMstrEstablishmentFiat.AddRange(establishmentsFiat); @@ -135,6 +141,13 @@ public void AddFurtherEducationEstablishmentsFiat( _misMstrFurtherEducationEstablishmentFiat.AddRange(furtherEducationEstablishmentsFiat); } + public void AddFurtherEducationEstablishmentsFiat( + params MisMstrFurtherEducationEstablishmentFiat[] furtherEducationEstablishmentsFiat) + { + AddFurtherEducationEstablishmentsFiat( + (IEnumerable)furtherEducationEstablishmentsFiat); + } + public void AddGiasEstablishment(GiasEstablishment giasEstablishment) { _giasEstablishments.Add(giasEstablishment); diff --git a/tests/DfE.FindInformationAcademiesTrusts.Data.AcademiesDb.UnitTests/Repositories/AcademyRepositoryOfstedTests.cs b/tests/DfE.FindInformationAcademiesTrusts.Data.AcademiesDb.UnitTests/Repositories/AcademyRepositoryOfstedTests.cs index 80e6c003d..108ca7751 100644 --- a/tests/DfE.FindInformationAcademiesTrusts.Data.AcademiesDb.UnitTests/Repositories/AcademyRepositoryOfstedTests.cs +++ b/tests/DfE.FindInformationAcademiesTrusts.Data.AcademiesDb.UnitTests/Repositories/AcademyRepositoryOfstedTests.cs @@ -476,7 +476,8 @@ public async Task GetAcademiesInTrustOfstedAsync_should_only_query_further_ed_fo // The first three urns are set up in non-further establishments with a non-further only property var nonFurtherUrns = allUrns.Take(3).ToArray(); _mockAcademiesDbContext.AddEstablishmentsFiat( - nonFurtherUrns.Select(urn => new MisMstrEstablishmentFiat { Urn = urn, EarlyYearsProvisionWhereApplicable = 1 })); + nonFurtherUrns.Select(urn => new MisMstrEstablishmentFiat + { Urn = urn, EarlyYearsProvisionWhereApplicable = 1 })); // All urns are set up in further (note that this wouldn't occur in the actual db) _mockAcademiesDbContext.AddFurtherEducationEstablishmentsFiat( @@ -660,4 +661,241 @@ public async Task academyOfsted.CurrentOfstedRating.OverallEffectiveness.Should().Be(expectedCurrentScore); academyOfsted.PreviousOfstedRating.OverallEffectiveness.Should().Be(expectedPreviousScore); } + + [Fact] + public async Task + GetAcademiesInTrustOfstedAsync_should_remove_single_headline_grades_issued_after_2nd_sept_2024() + { + // Arrange + var giasGroupLinks = AddGiasGroupLinksToMockDb(8); + + // - Add non-further eds + _mockAcademiesDbContext.AddEstablishmentsFiat( + new MisMstrEstablishmentFiat // OverallEffectiveness set after policy change date + { + Urn = int.Parse(giasGroupLinks[0].Urn!), + OverallEffectiveness = "1", + PreviousFullInspectionOverallEffectiveness = "3", + InspectionStartDate = "01/01/2025", + PreviousInspectionStartDate = "01/01/2021" + }, + new MisMstrEstablishmentFiat // OverallEffectiveness set on policy change date + { + Urn = int.Parse(giasGroupLinks[1].Urn!), + OverallEffectiveness = "2", + InspectionStartDate = "02/09/2024" + }, + new MisMstrEstablishmentFiat // PreviousFullInspectionOverallEffectiveness set after policy change date + { + Urn = int.Parse(giasGroupLinks[2].Urn!), + OverallEffectiveness = "Not judged", + PreviousFullInspectionOverallEffectiveness = "3", + InspectionStartDate = "01/01/2025", + PreviousInspectionStartDate = "12/12/2024" + }, + new MisMstrEstablishmentFiat // PreviousFullInspectionOverallEffectiveness set on policy change date + { + Urn = int.Parse(giasGroupLinks[3].Urn!), + OverallEffectiveness = "Not judged", + PreviousFullInspectionOverallEffectiveness = "4", + InspectionStartDate = "01/01/2025", + PreviousInspectionStartDate = "02/09/2024" + }); + // - Add further eds + _mockAcademiesDbContext.AddFurtherEducationEstablishmentsFiat( + new MisMstrFurtherEducationEstablishmentFiat // OverallEffectiveness set after policy change date + { + ProviderUrn = int.Parse(giasGroupLinks[4].Urn!), + OverallEffectiveness = "1", + PreviousOverallEffectiveness = "3", + LastDayOfInspection = "01/01/2025", + PreviousLastDayOfInspection = "01/01/2021" + }, + new MisMstrFurtherEducationEstablishmentFiat // OverallEffectiveness set on policy change date + { + ProviderUrn = int.Parse(giasGroupLinks[5].Urn!), + OverallEffectiveness = "2", + LastDayOfInspection = "02/09/2024" + }, + new + MisMstrFurtherEducationEstablishmentFiat // PreviousFullInspectionOverallEffectiveness set after policy change date + { + ProviderUrn = int.Parse(giasGroupLinks[6].Urn!), + OverallEffectiveness = "Not judged", + PreviousOverallEffectiveness = "3", + LastDayOfInspection = "01/01/2025", + PreviousLastDayOfInspection = "12/12/2024" + }, + new + MisMstrFurtherEducationEstablishmentFiat // PreviousFullInspectionOverallEffectiveness set on policy change date + { + ProviderUrn = int.Parse(giasGroupLinks[7].Urn!), + OverallEffectiveness = "Not judged", + PreviousOverallEffectiveness = "4", + LastDayOfInspection = "01/01/2025", + PreviousLastDayOfInspection = "02/09/2024" + } + ); + + // Act + var result = await _sut.GetAcademiesInTrustOfstedAsync(GroupUid); + + // Assert + result.Should().SatisfyRespectively( + // Non-further eds + rating => // OverallEffectiveness set after policy change date + { + rating.CurrentOfstedRating.OverallEffectiveness.Should() + .Be(OfstedRatingScore.SingleHeadlineGradeNotAvailable); + rating.PreviousOfstedRating.OverallEffectiveness.Should() + .NotBe(OfstedRatingScore.SingleHeadlineGradeNotAvailable); + }, + rating => // OverallEffectiveness set on policy change date + { + rating.CurrentOfstedRating.OverallEffectiveness.Should() + .Be(OfstedRatingScore.SingleHeadlineGradeNotAvailable); + rating.PreviousOfstedRating.OverallEffectiveness.Should() + .NotBe(OfstedRatingScore.SingleHeadlineGradeNotAvailable); + }, + rating => // PreviousFullInspectionOverallEffectiveness set after policy change date + { + rating.CurrentOfstedRating.OverallEffectiveness.Should() + .Be(OfstedRatingScore.SingleHeadlineGradeNotAvailable); + rating.PreviousOfstedRating.OverallEffectiveness.Should() + .Be(OfstedRatingScore.SingleHeadlineGradeNotAvailable); + }, + rating => // PreviousFullInspectionOverallEffectiveness set on policy change date + { + rating.CurrentOfstedRating.OverallEffectiveness.Should() + .Be(OfstedRatingScore.SingleHeadlineGradeNotAvailable); + rating.PreviousOfstedRating.OverallEffectiveness.Should() + .Be(OfstedRatingScore.SingleHeadlineGradeNotAvailable); + }, + + // Further eds + rating => // OverallEffectiveness set after policy change date + { + rating.CurrentOfstedRating.OverallEffectiveness.Should() + .Be(OfstedRatingScore.SingleHeadlineGradeNotAvailable); + rating.PreviousOfstedRating.OverallEffectiveness.Should() + .NotBe(OfstedRatingScore.SingleHeadlineGradeNotAvailable); + }, + rating => // OverallEffectiveness set on policy change date + { + rating.CurrentOfstedRating.OverallEffectiveness.Should() + .Be(OfstedRatingScore.SingleHeadlineGradeNotAvailable); + rating.PreviousOfstedRating.OverallEffectiveness.Should() + .NotBe(OfstedRatingScore.SingleHeadlineGradeNotAvailable); + }, + rating => // PreviousFullInspectionOverallEffectiveness set after policy change date + { + rating.CurrentOfstedRating.OverallEffectiveness.Should() + .Be(OfstedRatingScore.SingleHeadlineGradeNotAvailable); + rating.PreviousOfstedRating.OverallEffectiveness.Should() + .Be(OfstedRatingScore.SingleHeadlineGradeNotAvailable); + }, + rating => // PreviousFullInspectionOverallEffectiveness set on policy change date + { + rating.CurrentOfstedRating.OverallEffectiveness.Should() + .Be(OfstedRatingScore.SingleHeadlineGradeNotAvailable); + rating.PreviousOfstedRating.OverallEffectiveness.Should() + .Be(OfstedRatingScore.SingleHeadlineGradeNotAvailable); + } + ); + + //Assert error logging occurred + _mockLogger.VerifyLogError( + $"URN {giasGroupLinks[0].Urn!} has a current Ofsted single headline grade of Outstanding issued"); + _mockLogger.VerifyLogError( + $"URN {giasGroupLinks[1].Urn!} has a current Ofsted single headline grade of Good issued"); + _mockLogger.VerifyLogError( + $"URN {giasGroupLinks[2].Urn!} has a previous Ofsted single headline grade of RequiresImprovement issued"); + _mockLogger.VerifyLogError( + $"URN {giasGroupLinks[3].Urn!} has a previous Ofsted single headline grade of Inadequate issued"); + _mockLogger.VerifyLogError( + $"URN {giasGroupLinks[4].Urn!} has a current Ofsted single headline grade of Outstanding issued"); + _mockLogger.VerifyLogError( + $"URN {giasGroupLinks[5].Urn!} has a current Ofsted single headline grade of Good issued"); + _mockLogger.VerifyLogError( + $"URN {giasGroupLinks[6].Urn!} has a previous Ofsted single headline grade of RequiresImprovement issued"); + _mockLogger.VerifyLogError( + $"URN {giasGroupLinks[7].Urn!} has a previous Ofsted single headline grade of Inadequate issued"); + _mockLogger.VerifyNoOtherCalls(); + } + + [Fact] + public async Task GetAcademiesInTrustOfstedAsync_should_not_log_error_for_valid_overall_effectiveness() + { + // Arrange + var giasGroupLinks = AddGiasGroupLinksToMockDb(8); + + // - Add non-further eds + _mockAcademiesDbContext.AddEstablishmentsFiat( + new MisMstrEstablishmentFiat // OverallEffectiveness before policy change date + { + Urn = int.Parse(giasGroupLinks[0].Urn!), + OverallEffectiveness = "1", + PreviousFullInspectionOverallEffectiveness = "2", + InspectionStartDate = "01/09/2024", + PreviousInspectionStartDate = "01/01/2021" + }, + new MisMstrEstablishmentFiat // Not judged on policy change date + { + Urn = int.Parse(giasGroupLinks[1].Urn!), + OverallEffectiveness = "Not judged", + PreviousFullInspectionOverallEffectiveness = "2", + InspectionStartDate = "02/09/2024", + PreviousInspectionStartDate = "01/01/2021" + }, + new MisMstrEstablishmentFiat // Not judged after policy change date + { + Urn = int.Parse(giasGroupLinks[2].Urn!), + OverallEffectiveness = "Not judged", + PreviousFullInspectionOverallEffectiveness = "Not judged", + InspectionStartDate = "20/05/2025", + PreviousInspectionStartDate = "02/09/2024" + }, + new MisMstrEstablishmentFiat // Not inspected + { + Urn = int.Parse(giasGroupLinks[3].Urn!) + } + ); + + // - Add further eds + _mockAcademiesDbContext.AddFurtherEducationEstablishmentsFiat( + new MisMstrFurtherEducationEstablishmentFiat // OverallEffectiveness before policy change date + { + ProviderUrn = int.Parse(giasGroupLinks[4].Urn!), + OverallEffectiveness = "1", + PreviousOverallEffectiveness = "2", + LastDayOfInspection = "01/09/2024", + PreviousLastDayOfInspection = "01/01/2021" + }, + new MisMstrFurtherEducationEstablishmentFiat // Not judged on policy change date + { + ProviderUrn = int.Parse(giasGroupLinks[5].Urn!), + OverallEffectiveness = "Not judged", + PreviousOverallEffectiveness = "2", + LastDayOfInspection = "02/09/2024", + PreviousLastDayOfInspection = "01/01/2021" + }, + new MisMstrFurtherEducationEstablishmentFiat // Not judged after policy change date + { + ProviderUrn = int.Parse(giasGroupLinks[6].Urn!), + OverallEffectiveness = "Not judged", + PreviousOverallEffectiveness = "Not judged", + LastDayOfInspection = "20/05/2025", + PreviousLastDayOfInspection = "02/09/2024" + }, + new MisMstrFurtherEducationEstablishmentFiat // Not inspected + { + ProviderUrn = int.Parse(giasGroupLinks[7].Urn!) + } + ); + + // Act + _ = await _sut.GetAcademiesInTrustOfstedAsync(GroupUid); + + _mockLogger.VerifyNoOtherCalls(); + } } diff --git a/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Mocks/MockLogger.cs b/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Mocks/MockLogger.cs index 4f0067f22..9ae12d4dc 100644 --- a/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Mocks/MockLogger.cs +++ b/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Mocks/MockLogger.cs @@ -28,7 +28,7 @@ private MockLogger VerifyLog(LogLevel expectedLogLevel, string expectedMessag It.Is((v, t) => v.ToString()!.Contains(expectedMessage)), It.IsAny(), It.IsAny>() - ) + ), Times.Once, $"Couldn't find {expectedLogLevel} log containing \"{expectedMessage}\"" ); return this; From beafeb4eec9645a99d66079455cbafc3c30897d0 Mon Sep 17 00:00:00 2001 From: CMurrell148 Date: Wed, 29 Jan 2025 14:47:44 +0000 Subject: [PATCH 12/21] add testdataid for currentorprevious and unit test --- .../Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml | 8 +++++--- .../Ofsted/_SingleHeadlineGradeCells.cshtml.cs | 2 ++ .../Ofsted/SingleHeadlineGradeCellsModelTests.cs | 13 +++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml index f1f4a9f97..4a28dca70 100644 --- a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml +++ b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml @@ -1,7 +1,8 @@ @model SingleHeadlineGradeCellsModel @* Single headline grade *@ - -@* Inspection date *@ - diff --git a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml.cs b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml.cs index c56e73864..ff79e5dae 100644 --- a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml.cs +++ b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml.cs @@ -37,6 +37,8 @@ or OfstedRatingScore.RequiresImprovement SingleHeadlineGradeRating.InspectionDate?.ToString(StringFormatConstants.SortableDateFormat) ?? "0"; + public string DataTestIdPrefix => $"ofsted-single-headline-grades-{(IsCurrent ? "current" : "previous")}"; + public string SingleHeadlineGradeText => SingleHeadlineGradeRating.OverallEffectiveness.ToDisplayString(IsCurrent); public int SingleHeadlineGradeSort => SingleHeadlineGradeRating.OverallEffectiveness.ToDataSortValue(); } diff --git a/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/Ofsted/SingleHeadlineGradeCellsModelTests.cs b/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/Ofsted/SingleHeadlineGradeCellsModelTests.cs index eeacf782d..efa04a076 100644 --- a/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/Ofsted/SingleHeadlineGradeCellsModelTests.cs +++ b/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Pages/Trusts/Ofsted/SingleHeadlineGradeCellsModelTests.cs @@ -192,4 +192,17 @@ public void SingleHeadlineGradeSort_should_return_ToDataSortValue(OfstedRatingSc sut.SingleHeadlineGradeSort.Should().Be(expected); } + + [Theory] + [InlineData(true, "ofsted-single-headline-grades-current")] + [InlineData(false, "ofsted-single-headline-grades-previous")] + public void DataTestIdPrefix_should_contain_inspection_type(bool isCurrent, string expected) + { + var sut = _singleHeadlineGradeCellsModel with + { + IsCurrent = isCurrent + }; + + sut.DataTestIdPrefix.Should().Be(expected); + } } From 93693f931c4d6912a0d17554e498b85ffeb4300b Mon Sep 17 00:00:00 2001 From: CMurrell148 Date: Thu, 30 Jan 2025 10:35:49 +0000 Subject: [PATCH 13/21] add before or after datatest id for shg --- .../Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml index 4a28dca70..f593eafe7 100644 --- a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml +++ b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml @@ -2,13 +2,16 @@ @* Single headline grade *@
Single headline grades
Date joined + Current single headline grade Date of current inspection + Previous single headline grade diff --git a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml index fd6d69d7a..f1f4a9f97 100644 --- a/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml +++ b/DfE.FindInformationAcademiesTrusts/Pages/Trusts/Ofsted/_SingleHeadlineGradeCells.cshtml @@ -1,24 +1,19 @@ -@using DfE.FindInformationAcademiesTrusts.Data -@using DfE.FindInformationAcademiesTrusts.Extensions -@using Microsoft.AspNetCore.Mvc.TagHelpers @model SingleHeadlineGradeCellsModel -@if (Model.SingleHeadlineGradeRating.OverallEffectiveness == OfstedRatingScore.NotInspected) -{ - - @OfstedRatingScore.NotInspected.ToDisplayString(Model.IsCurrent) - - @OfstedRatingScore.NotInspected.ToDisplayString(Model.IsCurrent) - - @Model.SingleHeadlineGradeRating.OverallEffectiveness.ToDisplayString(Model.IsCurrent) - - - @Model.SingleHeadlineGradeRating.InspectionDate.ShowDateStringOrReplaceWithText() - + + @Model.SingleHeadlineGradeText + + @if (Model.HasInspection) + { + + @Model.TagLabel + + } + + @Model.InspectionDateText + + @Model.SingleHeadlineGradeText @@ -13,7 +14,8 @@ } +@* Inspection date *@ + @Model.InspectionDateText - + data-sort-value="@Model.SingleHeadlineGradeSort"> + @Model.SingleHeadlineGradeText @if (Model.HasInspection) { - + @Model.TagLabel } From 6f9b9f8629b97b05f17c37df5c6326227f9c08c8 Mon Sep 17 00:00:00 2001 From: CMurrell148 Date: Thu, 30 Jan 2025 14:03:01 +0000 Subject: [PATCH 14/21] add ofsted single headline grade tests and page objects --- .../e2e/regression/trusts/ofsted-page.cy.ts | 79 +++++++++++++- .../cypress/pages/trusts/ofstedPage.ts | 101 +++++++++++++++++- 2 files changed, 178 insertions(+), 2 deletions(-) diff --git a/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/e2e/regression/trusts/ofsted-page.cy.ts b/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/e2e/regression/trusts/ofsted-page.cy.ts index 607ef1f6d..5ffc08d10 100644 --- a/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/e2e/regression/trusts/ofsted-page.cy.ts +++ b/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/e2e/regression/trusts/ofsted-page.cy.ts @@ -3,8 +3,84 @@ import navigation from "../../../pages/navigation"; import dataDownload from "../../../pages/trusts/dataDownload"; import commonPage from "../../../pages/commonPage"; +const testTrustOfstedData = [ + { + typeOfTrust: "single academy trust", + uid: 5527 + }, + { + typeOfTrust: "multi academy trust", + uid: 5712 + } +]; + describe("Testing the Ofsted page and its subpages ", () => { + testTrustOfstedData.forEach(({ typeOfTrust, uid }) => { + describe(`Testing the single headline grades page for a ${typeOfTrust}`, () => { + beforeEach(() => { + cy.login(); + cy.visit(`/trusts/ofsted/single-headline-grades?uid=${uid}`); + + cy.task('checkForFiles', 'cypress/downloads').then((files) => { + if (files) { + cy.task('clearDownloads', 'cypress/downloads'); + } + }); + }); + + it("Checks the correct Ofsted single headline grades subpage header is present", () => { + ofstedPage + .checkOfstedSHGPageHeaderPresent(); + }); + + it("Checks the browser title is correct", () => { + commonPage + .checkThatBrowserTitleForTrustPageMatches('Single headline grades - Ofsted - {trustName} - Find information about academies and trusts'); + }); + + it("Checks the breadcrumb shows the correct page name", () => { + navigation + .checkPageNameBreadcrumbPresent("Ofsted"); + }); + + it("Checks the correct Ofsted single headline grades table headers are present", () => { + ofstedPage + .checkOfstedSHGTableHeadersPresent(); + }); + + it("Checks the Ofsted current ratings page sorting", () => { + ofstedPage + .checkOfstedSHGSorting(); + }); + + it("Checks that a trusts current and previous ratings correct judgement types are present", () => { + ofstedPage + .checkSHGCurrentSHGJudgementsPresent() + .checkSHGPreviousSHGJudgementsPresent() + .checkSHGCurrentSHGBeforeOrAfterPresent() + .checkSHGPreviousSHGBeforeOrAfterPresent(); + }); + + it("Checks that the single headline grades dates are within the correct parameters", () => { + ofstedPage + .checkSHGDateJoinedPresent() + .checkSHGDateOfCurrentInspectionPresent() + .checkSHGDateOfPreviousInspectionPresent(); + }); + + it('should export academies data as an xlsx and verify it has downloaded and has content', () => { + ofstedPage + .clickDownloadButton(); + dataDownload + .checkFileDownloaded() + .checkFileHasContent() + .deleteDownloadedFile(); + }); + + }); + }); + describe("Testing the Ofsted current ratings page ", () => { beforeEach(() => { cy.login(); @@ -273,7 +349,8 @@ describe("Testing the Ofsted page and its subpages ", () => { describe("Testing a trust that has no ofsted data within it to ensure the issue of a 500 page appearing does not happen", () => { beforeEach(() => { cy.login(); - commonPage.interceptAndVerifyNo500Errors(); + commonPage + .interceptAndVerifyNo500Errors(); }); ['/trusts/ofsted/current-ratings?uid=17728', '/trusts/ofsted/previous-ratings?uid=17728', '/trusts/ofsted/important-dates?uid=17728', '/trusts/ofsted/safeguarding-and-concerns?uid=17728'].forEach((url) => { diff --git a/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/pages/trusts/ofstedPage.ts b/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/pages/trusts/ofstedPage.ts index e4cae098f..e328ca4d8 100644 --- a/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/pages/trusts/ofstedPage.ts +++ b/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/pages/trusts/ofstedPage.ts @@ -5,6 +5,23 @@ class OfstedPage { elements = { subpageHeader: () => cy.get('[data-testid="subpage-header"]'), downloadButton: () => cy.get('[data-testid="download-all-ofsted-data-button"]'), + singleHeadlineGrades: { + section: () => cy.get('[data-testid="ofsted-single-headline-grades-school-name-table"]'), + schoolName: () => this.elements.singleHeadlineGrades.section().find('[data-testid="ofsted-single-headline-grades-school-name"]'), + schoolNameHeader: () => this.elements.singleHeadlineGrades.section().find('[data-testid="ofsted-single-headline-grades-school-name-header"]'), + dateJoined: () => this.elements.singleHeadlineGrades.section().find('[data-testid="ofsted-single-headline-grades-date-joined"]'), + dateJoinedHeader: () => this.elements.singleHeadlineGrades.section().find('[data-testid="ofsted-single-headline-grades-date-joined-header"]'), + currentSHG: () => this.elements.singleHeadlineGrades.section().find('[data-testid="ofsted-single-headline-grades-current-single-headline-grade"]'), + currentSHGBeforeOrAfter: () => this.elements.singleHeadlineGrades.section().find('[data-testid="ofsted-single-headline-grades-current-before-after-joining"]'), + currentSHGHeader: () => this.elements.singleHeadlineGrades.section().find('[data-testid="ofsted-single-headline-grades-current-single-headline-grade-header"]'), + dateOfCurrentInspection: () => this.elements.singleHeadlineGrades.section().find('[data-testid="ofsted-single-headline-grades-current-date-of-inspection"]'), + dateOfCurrentInspectionHeader: () => this.elements.singleHeadlineGrades.section().find('[data-testid="ofsted-single-headline-grades-date-of-current-inspection-header"]'), + previousSHG: () => this.elements.singleHeadlineGrades.section().find('[data-testid="ofsted-single-headline-grades-previous-single-headline-grade"]'), + previousSHGBeforeOrAfter: () => this.elements.singleHeadlineGrades.section().find('[data-sort-value="3"] > [data-testid="ofsted-single-headline-grades-previous-before-after-joining"]'), + previousSHGHeader: () => this.elements.singleHeadlineGrades.section().find('[data-testid="ofsted-single-headline-grades-previous-single-headline-grade-header"]'), + dateOfPreviousInspection: () => this.elements.singleHeadlineGrades.section().find('[data-testid="ofsted-single-headline-grades-previous-date-of-inspection"]'), + dateOfPreviousInspectionHeader: () => this.elements.singleHeadlineGrades.section().find('[data-testid="ofsted-single-headline-grades-date-of-previous-inspection-header"]'), + }, currentRatings: { section: () => cy.get('[data-testid="ofsted-current-ratings-table"]'), schoolName: () => this.elements.currentRatings.section().find('[data-testid="ofsted-current-ratings-school-name"]'), @@ -83,10 +100,92 @@ class OfstedPage { private readonly checkValueIsValidBeforeOrAfterJoiningTag = (element: JQuery) => { const text = element.text().trim(); - expect(text).to.match(/^(Before|After|Not yet inspected)$/); + expect(text).to.match(/^(Before|After|Not yet inspected|After joining|Before joining)$/); }; // #endregion + + // #region Single headline grades + public checkOfstedSHGPageHeaderPresent(): this { + this.elements.subpageHeader().should('contain', 'Single headline grades'); + return this; + } + + public checkOfstedSHGTableHeadersPresent(): this { + this.elements.singleHeadlineGrades.schoolNameHeader().should('be.visible'); + this.elements.singleHeadlineGrades.dateJoinedHeader().should('be.visible'); + this.elements.singleHeadlineGrades.currentSHGHeader().should('be.visible'); + this.elements.singleHeadlineGrades.dateOfCurrentInspectionHeader().should('be.visible'); + this.elements.singleHeadlineGrades.previousSHGHeader().should('be.visible'); + this.elements.singleHeadlineGrades.dateOfPreviousInspectionHeader().should('be.visible'); + return this; + } + + public checkOfstedSHGSorting(): this { + TableUtility.checkStringSorting( + this.elements.singleHeadlineGrades.schoolName, + this.elements.singleHeadlineGrades.schoolNameHeader + ); + TableUtility.checkStringSorting( + this.elements.singleHeadlineGrades.dateJoined, + this.elements.singleHeadlineGrades.dateJoinedHeader + ); + TableUtility.checkStringSorting( + this.elements.singleHeadlineGrades.currentSHG, + this.elements.singleHeadlineGrades.currentSHGHeader + ); + TableUtility.checkStringSorting( + this.elements.singleHeadlineGrades.dateOfCurrentInspection, + this.elements.singleHeadlineGrades.dateOfCurrentInspectionHeader + ); + TableUtility.checkStringSorting( + this.elements.singleHeadlineGrades.previousSHG, + this.elements.singleHeadlineGrades.previousSHGHeader + ); + TableUtility.checkStringSorting( + this.elements.singleHeadlineGrades.dateOfPreviousInspection, + this.elements.singleHeadlineGrades.dateOfPreviousInspectionHeader + ); + return this; + } + + public checkSHGDateJoinedPresent(): this { + this.elements.singleHeadlineGrades.dateJoined().each(this.checkValueIsValidDate); + return this; + } + + public checkSHGDateOfCurrentInspectionPresent(): this { + this.elements.singleHeadlineGrades.dateOfCurrentInspection().each(this.checkValueIsValidDate); + return this; + } + + public checkSHGDateOfPreviousInspectionPresent(): this { + this.elements.singleHeadlineGrades.dateOfPreviousInspection().each(this.checkValueIsValidDate); + return this; + } + + public checkSHGCurrentSHGJudgementsPresent(): this { + this.elements.singleHeadlineGrades.currentSHG().each(this.checkValueIsValidOfstedRating); + return this; + } + + public checkSHGPreviousSHGJudgementsPresent(): this { + this.elements.singleHeadlineGrades.previousSHG().each(this.checkValueIsValidOfstedRating); + return this; + } + + public checkSHGCurrentSHGBeforeOrAfterPresent(): this { + this.elements.singleHeadlineGrades.currentSHGBeforeOrAfter().each(this.checkValueIsValidBeforeOrAfterJoiningTag); + return this; + } + + public checkSHGPreviousSHGBeforeOrAfterPresent(): this { + this.elements.singleHeadlineGrades.previousSHGBeforeOrAfter().each(this.checkValueIsValidBeforeOrAfterJoiningTag); + return this; + } + + // #endreigon + // #region Current ratings public checkOfstedCurrentRatingsPageHeaderPresent(): this { From 04e3012191515358dd27abb4ca8ee2e02308f502 Mon Sep 17 00:00:00 2001 From: CMurrell148 Date: Thu, 30 Jan 2025 15:23:48 +0000 Subject: [PATCH 15/21] remove important date tests and update 500 error check to include shg --- .../e2e/regression/trusts/ofsted-page.cy.ts | 65 +------------------ .../cypress/support/test-data-store.ts | 2 +- 2 files changed, 2 insertions(+), 65 deletions(-) diff --git a/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/e2e/regression/trusts/ofsted-page.cy.ts b/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/e2e/regression/trusts/ofsted-page.cy.ts index 5ffc08d10..cb02a49d0 100644 --- a/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/e2e/regression/trusts/ofsted-page.cy.ts +++ b/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/e2e/regression/trusts/ofsted-page.cy.ts @@ -283,69 +283,6 @@ describe("Testing the Ofsted page and its subpages ", () => { }); }); - describe("Testing the Ofsted important dates page ", () => { - beforeEach(() => { - cy.login(); - cy.visit('/trusts/ofsted/important-dates?uid=5143'); - - // Clear the downloads folder before running each test - cy.task('checkForFiles', 'cypress/downloads').then((files) => { - if (files) { - cy.task('clearDownloads', 'cypress/downloads'); - } - }); - }); - - it("Checks the correct Ofsted important dates sub page header is present", () => { - ofstedPage - .checkOfstedImportantDatesPageHeaderPresent(); - }); - - it("Checks the browser title is correct", () => { - commonPage - .checkThatBrowserTitleForTrustPageMatches('Important dates - Ofsted - {trustName} - Find information about academies and trusts'); - }); - - it("Checks the breadcrumb shows the correct page name", () => { - navigation - .checkPageNameBreadcrumbPresent("Ofsted"); - }); - - it("Checks the correct Ofsted important dates table headers are present", () => { - ofstedPage - .checkOfstedImportantDatesTableHeadersPresent(); - }); - - it("Checks that a trusts important dates fields are present ", () => { - ofstedPage - .checkDateJoinedPresent() - .checkDateOfCurrentInspectionPresent() - .checkDateOfPreviousInspectionPresent(); - }); - - it("Checks that a trusts important dates sorting is working", () => { - ofstedPage - .checkOfstedImportantDatesSorting(); - }); - - it("Checks that a different trusts important dates fields are present", () => { - cy.visit('/trusts/ofsted/important-dates?uid=5712'); - ofstedPage - .checkDateJoinedPresent() - .checkDateOfCurrentInspectionPresent() - .checkDateOfPreviousInspectionPresent(); - }); - - it('should export academies data as an xlsx and verify it has downloaded and has content', () => { - ofstedPage - .clickDownloadButton(); - dataDownload - .checkFileDownloaded() - .checkFileHasContent() - .deleteDownloadedFile(); - }); - }); - describe("Testing a trust that has no ofsted data within it to ensure the issue of a 500 page appearing does not happen", () => { beforeEach(() => { cy.login(); @@ -353,7 +290,7 @@ describe("Testing the Ofsted page and its subpages ", () => { .interceptAndVerifyNo500Errors(); }); - ['/trusts/ofsted/current-ratings?uid=17728', '/trusts/ofsted/previous-ratings?uid=17728', '/trusts/ofsted/important-dates?uid=17728', '/trusts/ofsted/safeguarding-and-concerns?uid=17728'].forEach((url) => { + ['/trusts/ofsted/single-headline-grades?uid=17728', '/trusts/ofsted/current-ratings?uid=17728', '/trusts/ofsted/previous-ratings?uid=17728', '/trusts/ofsted/safeguarding-and-concerns?uid=17728'].forEach((url) => { it(`Should have no 500 error on ${url}`, () => { cy.visit(url); }); diff --git a/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/support/test-data-store.ts b/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/support/test-data-store.ts index cb8af51b3..ccca264a5 100644 --- a/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/support/test-data-store.ts +++ b/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/support/test-data-store.ts @@ -19,9 +19,9 @@ export class TestDataStore { { pageName: "Ofsted", subpages: [ + { subpageName: "Single headline grades", url: `/trusts/ofsted/single-headline-grades?uid=${uid}` }, { subpageName: "Current ratings", url: `/trusts/ofsted/current-ratings?uid=${uid}` }, { subpageName: "Previous ratings", url: `/trusts/ofsted/previous-ratings?uid=${uid}` }, - { subpageName: "Important dates", url: `/trusts/ofsted/important-dates?uid=${uid}` }, { subpageName: "Safeguarding and concerns", url: `/trusts/ofsted/safeguarding-and-concerns?uid=${uid}` } ] }, From 5a47865c68c0df0e3271f1d315c0d3161b4c88d8 Mon Sep 17 00:00:00 2001 From: CMurrell148 Date: Thu, 30 Jan 2025 16:27:54 +0000 Subject: [PATCH 16/21] update the ofsted 500 tests to use testDataStore --- .../cypress/e2e/regression/data-sources.cy.ts | 2 +- .../cypress/e2e/regression/trusts/ofsted-page.cy.ts | 5 +++-- .../cypress/support/test-data-store.ts | 12 +++++++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/e2e/regression/data-sources.cy.ts b/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/e2e/regression/data-sources.cy.ts index 3d4e86892..db6e5da21 100644 --- a/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/e2e/regression/data-sources.cy.ts +++ b/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/e2e/regression/data-sources.cy.ts @@ -29,7 +29,7 @@ describe("Testing the data sources component", () => { }); describe("Trust pages", () => { - TestDataStore.GetTrustSubpagesForUid(5712).forEach(({ pageName, subpages }) => { + TestDataStore.GetAllTrustSubpagesForUid(5712).forEach(({ pageName, subpages }) => { const subpageNames = subpages.map(s => s.subpageName); describe(pageName, () => { diff --git a/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/e2e/regression/trusts/ofsted-page.cy.ts b/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/e2e/regression/trusts/ofsted-page.cy.ts index cb02a49d0..fcc52aa6a 100644 --- a/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/e2e/regression/trusts/ofsted-page.cy.ts +++ b/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/e2e/regression/trusts/ofsted-page.cy.ts @@ -2,6 +2,7 @@ import ofstedPage from "../../../pages/trusts/ofstedPage"; import navigation from "../../../pages/navigation"; import dataDownload from "../../../pages/trusts/dataDownload"; import commonPage from "../../../pages/commonPage"; +import { TestDataStore } from "../../../support/test-data-store"; const testTrustOfstedData = [ { @@ -290,8 +291,8 @@ describe("Testing the Ofsted page and its subpages ", () => { .interceptAndVerifyNo500Errors(); }); - ['/trusts/ofsted/single-headline-grades?uid=17728', '/trusts/ofsted/current-ratings?uid=17728', '/trusts/ofsted/previous-ratings?uid=17728', '/trusts/ofsted/safeguarding-and-concerns?uid=17728'].forEach((url) => { - it(`Should have no 500 error on ${url}`, () => { + TestDataStore.GetTrustSubpagesFor(17728, "Ofsted").forEach(({ subpageName, url }) => { + it(`Should have no 500 error on ${subpageName}`, () => { cy.visit(url); }); }); diff --git a/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/support/test-data-store.ts b/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/support/test-data-store.ts index ccca264a5..772470e4f 100644 --- a/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/support/test-data-store.ts +++ b/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/support/test-data-store.ts @@ -1,5 +1,15 @@ export class TestDataStore { - public static readonly GetTrustSubpagesForUid = (uid: number) => + public static readonly GetTrustSubpagesFor = (uid: number, pageName: string) => { + + const page = TestDataStore.GetAllTrustSubpagesForUid(uid).find(p => p.pageName == pageName); + + if (page === undefined) + throw new Error(`Page ${pageName} is not in the Cypress test data. Is this a new page that needs adding to TestDataStore?`); + + return page.subpages; + }; + + public static readonly GetAllTrustSubpagesForUid = (uid: number) => [ { pageName: "Overview", From 079dc5ac544d3333098864f22ea7f40a9002043e Mon Sep 17 00:00:00 2001 From: CMurrell148 Date: Thu, 30 Jan 2025 16:28:37 +0000 Subject: [PATCH 17/21] add new methods to handle ofsted rating values more resuably --- .../cypress/pages/trusts/ofstedPage.ts | 52 ++++++++++++------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/pages/trusts/ofstedPage.ts b/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/pages/trusts/ofstedPage.ts index e328ca4d8..5b1e387a3 100644 --- a/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/pages/trusts/ofstedPage.ts +++ b/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/pages/trusts/ofstedPage.ts @@ -85,9 +85,17 @@ class OfstedPage { } }; - private readonly checkValueIsValidOfstedRating = (element: JQuery) => { + private readonly checkElementMatches = (element: JQuery, expected: RegExp) => { const text = element.text().trim(); - expect(text).to.match(/^(Good|No judgement|Outstanding|Requires improvement|Inadequate|Not yet inspected|Insufficient evidence|Does not apply)$/); + expect(text).to.match(expected); + }; + + private readonly checkValueIsValidCurrentOfstedRating = (element: JQuery) => + this.checkElementMatches(element, /^(Good|Not available|Outstanding|Requires improvement|Inadequate|Not yet inspected|Insufficient evidence|Does not apply)$/); + + private readonly checkValueIsValidPreviousOfstedRating = (element: JQuery) => { + const text = element.text().trim(); + expect(text).to.match(/^(Good|Not available|Outstanding|Requires improvement|Inadequate|Not inspected|Insufficient evidence|Does not apply)$/); }; private readonly checkValueIsValidDate = (element: JQuery) => { @@ -100,7 +108,7 @@ class OfstedPage { private readonly checkValueIsValidBeforeOrAfterJoiningTag = (element: JQuery) => { const text = element.text().trim(); - expect(text).to.match(/^(Before|After|Not yet inspected|After joining|Before joining)$/); + expect(text).to.match(/^(Before|After|Not yet inspected)$/); }; // #endregion @@ -165,22 +173,26 @@ class OfstedPage { } public checkSHGCurrentSHGJudgementsPresent(): this { - this.elements.singleHeadlineGrades.currentSHG().each(this.checkValueIsValidOfstedRating); + this.elements.singleHeadlineGrades.currentSHG().each(this.checkValueIsValidCurrentOfstedRating); return this; } public checkSHGPreviousSHGJudgementsPresent(): this { - this.elements.singleHeadlineGrades.previousSHG().each(this.checkValueIsValidOfstedRating); + this.elements.singleHeadlineGrades.previousSHG().each(this.checkValueIsValidPreviousOfstedRating); return this; } public checkSHGCurrentSHGBeforeOrAfterPresent(): this { - this.elements.singleHeadlineGrades.currentSHGBeforeOrAfter().each(this.checkValueIsValidBeforeOrAfterJoiningTag); + this.elements.singleHeadlineGrades.currentSHGBeforeOrAfter().each((element: JQuery) => { + this.checkElementMatches(element, /^(Not yet inspected|After joining|Before joining)$/); + }); return this; } public checkSHGPreviousSHGBeforeOrAfterPresent(): this { - this.elements.singleHeadlineGrades.previousSHGBeforeOrAfter().each(this.checkValueIsValidBeforeOrAfterJoiningTag); + this.elements.singleHeadlineGrades.previousSHGBeforeOrAfter().each((element: JQuery) => { + this.checkElementMatches(element, /^(Not inspected|After joining|Before joining)$/); + }); return this; } @@ -243,32 +255,32 @@ class OfstedPage { } public checkCurrentRatingsQualityOfEducationJudgementsPresent(): this { - this.elements.currentRatings.qualityOfEducation().each(this.checkValueIsValidOfstedRating); + this.elements.currentRatings.qualityOfEducation().each(this.checkValueIsValidCurrentOfstedRating); return this; } public checkCurrentRatingsBehaviourAndAttitudesJudgementsPresent(): this { - this.elements.currentRatings.behaviourAndAttitudes().each(this.checkValueIsValidOfstedRating); + this.elements.currentRatings.behaviourAndAttitudes().each(this.checkValueIsValidCurrentOfstedRating); return this; } public checkCurrentRatingsPersonalDevelopmentJudgementsPresent(): this { - this.elements.currentRatings.personalDevelopment().each(this.checkValueIsValidOfstedRating); + this.elements.currentRatings.personalDevelopment().each(this.checkValueIsValidCurrentOfstedRating); return this; } public checkCurrentRatingsLeadershipAndManagementJudgementsPresent(): this { - this.elements.currentRatings.leadershipAndManagement().each(this.checkValueIsValidOfstedRating); + this.elements.currentRatings.leadershipAndManagement().each(this.checkValueIsValidCurrentOfstedRating); return this; } public checkCurrentRatingsEarlyYearsProvisionJudgementsPresent(): this { - this.elements.currentRatings.earlyYearsProvision().each(this.checkValueIsValidOfstedRating); + this.elements.currentRatings.earlyYearsProvision().each(this.checkValueIsValidCurrentOfstedRating); return this; } public checkCurrentRatingsSixthFormProvisionJudgementsPresent(): this { - this.elements.currentRatings.sixthFormProvision().each(this.checkValueIsValidOfstedRating); + this.elements.currentRatings.sixthFormProvision().each(this.checkValueIsValidCurrentOfstedRating); return this; } @@ -340,37 +352,37 @@ class OfstedPage { } public checkPreviousRatingsQualityOfEducationJudgementsPresent(): this { - this.elements.previousRatings.qualityOfEducation().each(this.checkValueIsValidOfstedRating); + this.elements.previousRatings.qualityOfEducation().each(this.checkValueIsValidPreviousOfstedRating); return this; } public checkPreviousRatingsBehaviourAndAttitudesJudgementsPresent(): this { - this.elements.previousRatings.behaviourAndAttitudes().each(this.checkValueIsValidOfstedRating); + this.elements.previousRatings.behaviourAndAttitudes().each(this.checkValueIsValidPreviousOfstedRating); return this; } public checkPreviousRatingsPersonalDevelopmentJudgementsPresent(): this { - this.elements.previousRatings.personalDevelopment().each(this.checkValueIsValidOfstedRating); + this.elements.previousRatings.personalDevelopment().each(this.checkValueIsValidPreviousOfstedRating); return this; } public checkPreviousRatingsLeadershipAndManagementJudgementsPresent(): this { - this.elements.previousRatings.leadershipAndManagement().each(this.checkValueIsValidOfstedRating); + this.elements.previousRatings.leadershipAndManagement().each(this.checkValueIsValidPreviousOfstedRating); return this; } public checkPreviousRatingsEarlyYearsProvisionJudgementsPresent(): this { - this.elements.previousRatings.earlyYearsProvision().each(this.checkValueIsValidOfstedRating); + this.elements.previousRatings.earlyYearsProvision().each(this.checkValueIsValidPreviousOfstedRating); return this; } public checkPreviousRatingsSixthFormProvisionJudgementsPresent(): this { - this.elements.previousRatings.sixthFormProvision().each(this.checkValueIsValidOfstedRating); + this.elements.previousRatings.sixthFormProvision().each(this.checkValueIsValidPreviousOfstedRating); return this; } public checkPreviousRatingsBeforeOrAfterJoiningJudgementsPresent(): this { - this.elements.previousRatings.beforeOrAfterJoining().each(this.checkValueIsValidBeforeOrAfterJoiningTag); + this.elements.previousRatings.beforeOrAfterJoining().each((element) => this.checkElementMatches(element, /^(Before|After|Not inspected)$/)); return this; } From 66bedf69f02078cd0f347ccfc7cad1a585a436be Mon Sep 17 00:00:00 2001 From: Sara Gowen <9001998+dynamictulip@users.noreply.github.com> Date: Thu, 30 Jan 2025 18:11:15 +0000 Subject: [PATCH 18/21] Improve mutation score on academies repo --- .../AcademyRepositoryOfstedTests.cs | 74 +++++++++++++------ .../Mocks/MockLogger.cs | 24 ++++-- 2 files changed, 70 insertions(+), 28 deletions(-) diff --git a/tests/DfE.FindInformationAcademiesTrusts.Data.AcademiesDb.UnitTests/Repositories/AcademyRepositoryOfstedTests.cs b/tests/DfE.FindInformationAcademiesTrusts.Data.AcademiesDb.UnitTests/Repositories/AcademyRepositoryOfstedTests.cs index 108ca7751..b79052a7c 100644 --- a/tests/DfE.FindInformationAcademiesTrusts.Data.AcademiesDb.UnitTests/Repositories/AcademyRepositoryOfstedTests.cs +++ b/tests/DfE.FindInformationAcademiesTrusts.Data.AcademiesDb.UnitTests/Repositories/AcademyRepositoryOfstedTests.cs @@ -667,7 +667,7 @@ public async Task GetAcademiesInTrustOfstedAsync_should_remove_single_headline_grades_issued_after_2nd_sept_2024() { // Arrange - var giasGroupLinks = AddGiasGroupLinksToMockDb(8); + var giasGroupLinks = AddGiasGroupLinksToMockDb(10); // - Add non-further eds _mockAcademiesDbContext.AddEstablishmentsFiat( @@ -700,12 +700,22 @@ public async Task PreviousFullInspectionOverallEffectiveness = "4", InspectionStartDate = "01/01/2025", PreviousInspectionStartDate = "02/09/2024" - }); + }, + new MisMstrEstablishmentFiat // OverallEffectiveness before policy change date + { + Urn = int.Parse(giasGroupLinks[4].Urn!), + OverallEffectiveness = "1", + PreviousFullInspectionOverallEffectiveness = "2", + InspectionStartDate = "01/09/2024", + PreviousInspectionStartDate = "01/01/2021" + } + ); + // - Add further eds _mockAcademiesDbContext.AddFurtherEducationEstablishmentsFiat( new MisMstrFurtherEducationEstablishmentFiat // OverallEffectiveness set after policy change date { - ProviderUrn = int.Parse(giasGroupLinks[4].Urn!), + ProviderUrn = int.Parse(giasGroupLinks[5].Urn!), OverallEffectiveness = "1", PreviousOverallEffectiveness = "3", LastDayOfInspection = "01/01/2025", @@ -713,14 +723,14 @@ public async Task }, new MisMstrFurtherEducationEstablishmentFiat // OverallEffectiveness set on policy change date { - ProviderUrn = int.Parse(giasGroupLinks[5].Urn!), + ProviderUrn = int.Parse(giasGroupLinks[6].Urn!), OverallEffectiveness = "2", LastDayOfInspection = "02/09/2024" }, new MisMstrFurtherEducationEstablishmentFiat // PreviousFullInspectionOverallEffectiveness set after policy change date { - ProviderUrn = int.Parse(giasGroupLinks[6].Urn!), + ProviderUrn = int.Parse(giasGroupLinks[7].Urn!), OverallEffectiveness = "Not judged", PreviousOverallEffectiveness = "3", LastDayOfInspection = "01/01/2025", @@ -729,12 +739,20 @@ public async Task new MisMstrFurtherEducationEstablishmentFiat // PreviousFullInspectionOverallEffectiveness set on policy change date { - ProviderUrn = int.Parse(giasGroupLinks[7].Urn!), + ProviderUrn = int.Parse(giasGroupLinks[8].Urn!), OverallEffectiveness = "Not judged", PreviousOverallEffectiveness = "4", LastDayOfInspection = "01/01/2025", PreviousLastDayOfInspection = "02/09/2024" - } + }, + new MisMstrFurtherEducationEstablishmentFiat // OverallEffectiveness before policy change date + { + ProviderUrn = int.Parse(giasGroupLinks[9].Urn!), + OverallEffectiveness = "1", + PreviousOverallEffectiveness = "2", + LastDayOfInspection = "01/09/2024", + PreviousLastDayOfInspection = "01/01/2021" + } ); // Act @@ -771,6 +789,13 @@ public async Task rating.PreviousOfstedRating.OverallEffectiveness.Should() .Be(OfstedRatingScore.SingleHeadlineGradeNotAvailable); }, + rating => // OverallEffectiveness before policy change date + { + rating.CurrentOfstedRating.OverallEffectiveness.Should() + .NotBe(OfstedRatingScore.SingleHeadlineGradeNotAvailable); + rating.PreviousOfstedRating.OverallEffectiveness.Should() + .NotBe(OfstedRatingScore.SingleHeadlineGradeNotAvailable); + }, // Further eds rating => // OverallEffectiveness set after policy change date @@ -800,26 +825,29 @@ public async Task .Be(OfstedRatingScore.SingleHeadlineGradeNotAvailable); rating.PreviousOfstedRating.OverallEffectiveness.Should() .Be(OfstedRatingScore.SingleHeadlineGradeNotAvailable); + }, + rating => // OverallEffectiveness before policy change date + { + rating.CurrentOfstedRating.OverallEffectiveness.Should() + .NotBe(OfstedRatingScore.SingleHeadlineGradeNotAvailable); + rating.PreviousOfstedRating.OverallEffectiveness.Should() + .NotBe(OfstedRatingScore.SingleHeadlineGradeNotAvailable); } ); //Assert error logging occurred - _mockLogger.VerifyLogError( - $"URN {giasGroupLinks[0].Urn!} has a current Ofsted single headline grade of Outstanding issued"); - _mockLogger.VerifyLogError( - $"URN {giasGroupLinks[1].Urn!} has a current Ofsted single headline grade of Good issued"); - _mockLogger.VerifyLogError( - $"URN {giasGroupLinks[2].Urn!} has a previous Ofsted single headline grade of RequiresImprovement issued"); - _mockLogger.VerifyLogError( - $"URN {giasGroupLinks[3].Urn!} has a previous Ofsted single headline grade of Inadequate issued"); - _mockLogger.VerifyLogError( - $"URN {giasGroupLinks[4].Urn!} has a current Ofsted single headline grade of Outstanding issued"); - _mockLogger.VerifyLogError( - $"URN {giasGroupLinks[5].Urn!} has a current Ofsted single headline grade of Good issued"); - _mockLogger.VerifyLogError( - $"URN {giasGroupLinks[6].Urn!} has a previous Ofsted single headline grade of RequiresImprovement issued"); - _mockLogger.VerifyLogError( - $"URN {giasGroupLinks[7].Urn!} has a previous Ofsted single headline grade of Inadequate issued"); + _mockLogger.VerifyLogErrors( + $"URN {giasGroupLinks[0].Urn!} has a current Ofsted single headline grade of Outstanding issued", + $"URN {giasGroupLinks[1].Urn!} has a current Ofsted single headline grade of Good issued", + $"URN {giasGroupLinks[2].Urn!} has a previous Ofsted single headline grade of RequiresImprovement issued", + $"URN {giasGroupLinks[3].Urn!} has a previous Ofsted single headline grade of Inadequate issued", + // giasGroupLinks[4] - OverallEffectiveness before policy change date so no error log expected + $"URN {giasGroupLinks[5].Urn!} has a current Ofsted single headline grade of Outstanding issued", + $"URN {giasGroupLinks[6].Urn!} has a current Ofsted single headline grade of Good issued", + $"URN {giasGroupLinks[7].Urn!} has a previous Ofsted single headline grade of RequiresImprovement issued", + $"URN {giasGroupLinks[8].Urn!} has a previous Ofsted single headline grade of Inadequate issued" + // giasGroupLinks[9] - OverallEffectiveness before policy change date so no error log expected + ); _mockLogger.VerifyNoOtherCalls(); } diff --git a/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Mocks/MockLogger.cs b/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Mocks/MockLogger.cs index 9ae12d4dc..2ef09d27f 100644 --- a/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Mocks/MockLogger.cs +++ b/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Mocks/MockLogger.cs @@ -1,3 +1,4 @@ +using System.Text.RegularExpressions; using Microsoft.Extensions.Logging; namespace DfE.FindInformationAcademiesTrusts.UnitTests.Mocks; @@ -14,21 +15,34 @@ public MockLogger VerifyLogWarning(string expectedMessage) return VerifyLog(LogLevel.Warning, expectedMessage); } - public MockLogger VerifyLogError(string expectedMessage) + public MockLogger VerifyLogError(string regexPattern) { - return VerifyLog(LogLevel.Error, expectedMessage); + VerifyLog(LogLevel.Error, regexPattern); + return this; + } + + public MockLogger VerifyLogErrors(params string[] regexPatterns) + { + foreach (var regexPattern in regexPatterns) + { + VerifyLogError(regexPattern); + } + + return this; } - private MockLogger VerifyLog(LogLevel expectedLogLevel, string expectedMessage) + private MockLogger VerifyLog(LogLevel expectedLogLevel, string regexPattern) { Verify( mock => mock.Log( It.Is(logLevel => logLevel == expectedLogLevel), It.IsAny(), - It.Is((v, t) => v.ToString()!.Contains(expectedMessage)), + It.Is((v, t) => Regex.IsMatch(v.ToString()!, regexPattern, RegexOptions.NonBacktracking)), It.IsAny(), It.IsAny>() - ), Times.Once, $"Couldn't find {expectedLogLevel} log containing \"{expectedMessage}\"" + ), + Times.Once, + $"Couldn't find {expectedLogLevel} log matching \"{regexPattern}\"" ); return this; From 68fe1a891874a23271cefa40bbf845d951884033 Mon Sep 17 00:00:00 2001 From: Sara Gowen <9001998+dynamictulip@users.noreply.github.com> Date: Fri, 31 Jan 2025 15:33:57 +0000 Subject: [PATCH 19/21] Added test for "Not inspected" and "Not yet inspected" to export Also added in an enum to keep track of column numbers --- .../Services/ExportServiceTests.cs | 68 ++++++++++++++++--- 1 file changed, 59 insertions(+), 9 deletions(-) diff --git a/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Services/ExportServiceTests.cs b/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Services/ExportServiceTests.cs index aac10fc45..7b85c64a5 100644 --- a/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Services/ExportServiceTests.cs +++ b/tests/DfE.FindInformationAcademiesTrusts.UnitTests/Services/ExportServiceTests.cs @@ -4,6 +4,7 @@ using DfE.FindInformationAcademiesTrusts.Data.Repositories.Trust; using DfE.FindInformationAcademiesTrusts.Services.Export; using DfE.FindInformationAcademiesTrusts.Services.Trust; +using FluentAssertions.Execution; namespace DfE.FindInformationAcademiesTrusts.UnitTests.Services; @@ -516,20 +517,69 @@ public async Task ExportOfstedDataToSpreadsheet_ShouldHandleNoOfstedDataAsync() .ReturnsAsync(new TrustSummary("Test Trust", "Multi-academy trust")); _mockAcademyRepository.Setup(m => m.GetAcademiesInTrustDetailsAsync("uid")) - .ReturnsAsync(new AcademyDetails[] - { - new("A123", "Academy XYZ", "TypeX", "Local LA", "Urban") - }); + .ReturnsAsync([ + new AcademyDetails("A123", "Academy XYZ", "TypeX", "Local LA", "Urban") + ]); - _mockAcademyRepository.Setup(m => m.GetAcademiesInTrustOfstedAsync("uid")) - .ReturnsAsync(Array.Empty()); + _mockAcademyRepository.Setup(m => m.GetAcademiesInTrustOfstedAsync("uid")).ReturnsAsync([]); var result = await _sut.ExportOfstedDataToSpreadsheetAsync("uid"); using var workbook = new XLWorkbook(new MemoryStream(result)); var worksheet = workbook.Worksheet("Ofsted"); - // If no Ofsted data, we get default "Not yet inspected" - worksheet.Cell(4, 5).Value.ToString().Should().Be("Not yet inspected"); - worksheet.Cell(4, 3).Value.ToString().Should().Be(string.Empty); // date of current inspection empty + using var scope = new AssertionScope(); + + //Current inspection + Cell(worksheet, 4, OfstedColumns.DateOfCurrentInspection).Should().Be(string.Empty); + Cell(worksheet, 4, OfstedColumns.CurrentBeforeAfterJoining).Should().Be(string.Empty); + Cell(worksheet, 4, OfstedColumns.CurrentQualityOfEducation).Should().Be("Not yet inspected"); + Cell(worksheet, 4, OfstedColumns.CurrentBehaviourAndAttitudes).Should().Be("Not yet inspected"); + Cell(worksheet, 4, OfstedColumns.CurrentPersonalDevelopment).Should().Be("Not yet inspected"); + Cell(worksheet, 4, OfstedColumns.CurrentLeadershipAndManagement).Should().Be("Not yet inspected"); + Cell(worksheet, 4, OfstedColumns.CurrentEarlyYearsProvision).Should().Be("Not yet inspected"); + Cell(worksheet, 4, OfstedColumns.CurrentSixthFormProvision).Should().Be("Not yet inspected"); + + //Previous inspection + Cell(worksheet, 4, OfstedColumns.DateOfPreviousInspection).Should().Be(string.Empty); + Cell(worksheet, 4, OfstedColumns.PreviousBeforeAfterJoining).Should().Be(string.Empty); + Cell(worksheet, 4, OfstedColumns.PreviousQualityOfEducation).Should().Be("Not inspected"); + Cell(worksheet, 4, OfstedColumns.PreviousBehaviourAndAttitudes).Should().Be("Not inspected"); + Cell(worksheet, 4, OfstedColumns.PreviousPersonalDevelopment).Should().Be("Not inspected"); + Cell(worksheet, 4, OfstedColumns.PreviousLeadershipAndManagement).Should().Be("Not inspected"); + Cell(worksheet, 4, OfstedColumns.PreviousEarlyYearsProvision).Should().Be("Not inspected"); + Cell(worksheet, 4, OfstedColumns.PreviousSixthFormProvision).Should().Be("Not inspected"); + + //Safeguarding and concerns + Cell(worksheet, 4, OfstedColumns.EffectiveSafeguarding).Should().Be("Not yet inspected"); + Cell(worksheet, 4, OfstedColumns.CategoryOfConcern).Should().Be("Not yet inspected"); + } + + private static string Cell(IXLWorksheet worksheet, int rowNumber, OfstedColumns column) + { + return worksheet.Cell(rowNumber, (int)column).Value.ToString(); + } + + private enum OfstedColumns + { + SchoolName = 1, + DateJoined = 2, + DateOfCurrentInspection = 3, + CurrentBeforeAfterJoining = 4, + CurrentQualityOfEducation = 5, + CurrentBehaviourAndAttitudes = 6, + CurrentPersonalDevelopment = 7, + CurrentLeadershipAndManagement = 8, + CurrentEarlyYearsProvision = 9, + CurrentSixthFormProvision = 10, + DateOfPreviousInspection = 11, + PreviousBeforeAfterJoining = 12, + PreviousQualityOfEducation = 13, + PreviousBehaviourAndAttitudes = 14, + PreviousPersonalDevelopment = 15, + PreviousLeadershipAndManagement = 16, + PreviousEarlyYearsProvision = 17, + PreviousSixthFormProvision = 18, + EffectiveSafeguarding = 19, + CategoryOfConcern = 20 } } From 970ce75e99ae0f536697f37dcc1d3c654296c7d7 Mon Sep 17 00:00:00 2001 From: Sara Gowen <9001998+dynamictulip@users.noreply.github.com> Date: Fri, 31 Jan 2025 15:42:38 +0000 Subject: [PATCH 20/21] Remove "important dates" from cypress page object model --- .../cypress/pages/trusts/ofstedPage.ts | 68 +++---------------- 1 file changed, 10 insertions(+), 58 deletions(-) diff --git a/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/pages/trusts/ofstedPage.ts b/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/pages/trusts/ofstedPage.ts index 5b1e387a3..2ca0e8b08 100644 --- a/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/pages/trusts/ofstedPage.ts +++ b/tests/DFE.FindInformationAcademiesTrusts.CypressTests/cypress/pages/trusts/ofstedPage.ts @@ -113,6 +113,15 @@ class OfstedPage { // #endregion + // #region All sub pages + + public clickDownloadButton(): this { + this.elements.downloadButton().click(); + return this; + } + + // #endregion + // #region Single headline grades public checkOfstedSHGPageHeaderPresent(): this { this.elements.subpageHeader().should('contain', 'Single headline grades'); @@ -196,7 +205,7 @@ class OfstedPage { return this; } - // #endreigon + // #endregion // #region Current ratings @@ -444,63 +453,6 @@ class OfstedPage { } // #endregion - // #region Important Dates - - public checkOfstedImportantDatesPageHeaderPresent(): this { - this.elements.subpageHeader().should('contain', 'Important dates'); - return this; - } - - public checkOfstedImportantDatesTableHeadersPresent(): this { - this.elements.importantDates.schoolNameHeader().should('be.visible'); - this.elements.importantDates.dateJoinedHeader().should('be.visible'); - this.elements.importantDates.dateOfCurrentInspectionHeader().should('be.visible'); - this.elements.importantDates.dateOfPreviousInspectionHeader().should('be.visible'); - return this; - } - - public checkOfstedImportantDatesSorting(): this { - TableUtility.checkStringSorting( - this.elements.importantDates.schoolName, - this.elements.importantDates.schoolNameHeader - ); - TableUtility.checkStringSorting( - this.elements.importantDates.dateJoined, - this.elements.importantDates.dateJoinedHeader - ); - TableUtility.checkStringSorting( - this.elements.importantDates.dateOfCurrentInspection, - this.elements.importantDates.dateOfCurrentInspectionHeader - ); - TableUtility.checkStringSorting( - this.elements.importantDates.dateOfPreviousInspection, - this.elements.importantDates.dateOfPreviousInspectionHeader - ); - return this; - } - - - public checkDateJoinedPresent(): this { - this.elements.importantDates.dateJoined().each(this.checkValueIsValidDate); - return this; - } - - public checkDateOfCurrentInspectionPresent(): this { - this.elements.importantDates.dateOfCurrentInspection().each(this.checkValueIsValidDate); - return this; - } - - - public checkDateOfPreviousInspectionPresent(): this { - this.elements.importantDates.dateOfPreviousInspection().each(this.checkValueIsValidDate); - return this; - } - - public clickDownloadButton(): this { - this.elements.downloadButton().click(); - return this; - } - // #endregion } const ofstedPage = new OfstedPage(); From d134de38abc5c887de6bddc993f3e2ff00195da2 Mon Sep 17 00:00:00 2001 From: Sara Gowen <9001998+dynamictulip@users.noreply.github.com> Date: Fri, 31 Jan 2025 16:02:51 +0000 Subject: [PATCH 21/21] Add SHG to changelog --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d8cffc8f..e9263b970 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased][unreleased] +### Added + +- Added Single headline grades Ofsted subpage + +### Changed + - Updated accessibility statement text +- Page spacing tweak on Ofsted subpages +- All Ofsted subpage tables - previous sub-judgements for academies with no previous inspection now say "Not inspected" (instead of "Not yet inspected" which is used for current sub-judgements) +- Ofsted data download - previous sub-judgements for academies with no previous inspection now say "Not inspected" (instead of "Not yet inspected" which is used for current sub-judgements) + +### Removed + - Removed 'Date joined trust' from Ofsted data source list +- Removed Important dates Ofsted subpage ## [Release-19][release-19] (production-2025-01-20.4730)