Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions SAPData/GenerateViews.cs
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ private static string GenerateEstablishmentDimensionView(
sb.AppendLine(" to_tsvector('english', normalize_text(coalesce(t.\"establishmentname\", ''))) AS \"EstablishmentNameFTS\",");
sb.AppendLine(" ST_Transform(\r\n ST_SetSRID(ST_MakePoint(clean_int(t.\"easting\"), clean_int(t.\"northing\")), 27700), 4326\r\n)::geography AS \"geom\",");
sb.AppendLine($" {BuildSenTypes()} AS \"SenTypes\",");
sb.AppendLine(" t.\"nurseryprovision__name_\" AS \"NurseryProvisionName\",");

bool hasWraparound = TryResolveRawTable(tableMap, "ks2_wraparound_care", out var wraparoundTable) && !string.IsNullOrWhiteSpace(wraparoundTable);
if (hasWraparound)
Expand Down
8 changes: 7 additions & 1 deletion SAPPub.Core/Entities/Establishment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ public class Establishment

public string? KS2WraparoundCare { get; set; } = string.Empty;

public bool FreeBreakfastClubProgramme { get; set; }

public string? NurseryProvisionName { get; set; }

[IgnoreDataMember]
public bool IsKS2 { get; set; }

Expand Down Expand Up @@ -175,7 +179,9 @@ public static EstablishmentServiceModel MapToServiceModel(Establishment e)
IsKS2 = e.IsKS2,
IsKS4 = e.IsKS4,
IsKS5 = e.IsKS5,
KS2WraparoundCare = e.KS2WraparoundCare
KS2WraparoundCare = e.KS2WraparoundCare,
FreeBreakfastClubProgramme = e.FreeBreakfastClubProgramme,
NurseryProvisionName = e.NurseryProvisionName
};
}
}
7 changes: 7 additions & 0 deletions SAPPub.Core/ServiceModels/EstablishmentServiceModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ public class EstablishmentServiceModel

public string? KS2WraparoundCare { get; set; } = string.Empty;

public bool FreeBreakfastClubProgramme { get; set; }

public string? NurseryProvisionName { get; set; } = string.Empty;

public bool HasNurseryProvision => NurseryProvisionName == "Has Nursery Classes";

public bool IsKS2 { get; set; }

public bool IsKS4 { get; set; }
Expand All @@ -130,6 +136,7 @@ TypeOfEstablishment.FreeSchoolsSpecial or
TypeOfEstablishment.OtherIndependentSchool or
TypeOfEstablishment.OtherIndependentSpecialSchool;


public EstablishmentPerformance KS4Performance { get; set; } = new();

public LAPerformance LAPerformance { get; set; } = new();
Expand Down
6 changes: 6 additions & 0 deletions SAPPub.Core/ServiceModels/KS4/AboutSchool/AboutSchoolModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ public class AboutSchoolModel

public string? SenTypes { get; set; }

public string? KS2WraparoundCare { get; set; }

public bool FreeBreakfastClubProgramme { get; set; }

public bool HasNurseryProvision { get; set; }

public bool IsKS2 { get; set; }

public bool IsKS4 { get; set; }
Expand Down
3 changes: 3 additions & 0 deletions SAPPub.Core/Services/KS4/AboutSchool/AboutSchoolService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ public async Task<AboutSchoolModel> GetAboutSchoolDetailsAsync(string urn, Cance
SenTypes = establishment.SenTypes,
Predecessors = predecessorLinks,
Successors = sucessorLinks,
KS2WraparoundCare = establishment.KS2WraparoundCare,
FreeBreakfastClubProgramme = establishment.FreeBreakfastClubProgramme,
HasNurseryProvision = establishment.HasNurseryProvision,
IsKS2 = establishment.IsKS2,
IsKS4 = establishment.IsKS4,
IsKS5 = establishment.IsKS5
Expand Down
4 changes: 3 additions & 1 deletion SAPPub.Infrastructure/Repositories/Helpers/DapperHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ public static class DapperHelpers
"ISKS2",
"ISKS4",
"ISKS5",
"KS2WraparoundCare"
"KS2WraparoundCare",
"FreeBreakfastClubProgramme",
"NurseryProvisionName"
""";

private const string EstablishmentAbsenceColumns = """
Expand Down
5 changes: 2 additions & 3 deletions SAPPub.Web/Areas/Profiles/Controllers/AdmissionsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public async Task<IActionResult> KS2(
CancellationToken ct)
{
var admissionsDetails = await admissionsService.GetAdmissionsDetailsAsync(urn, ct);
var model = AdmissionsViewModel.MapFrom(admissionsDetails, urn, true);
var model = AdmissionsViewModel.MapFrom(admissionsDetails, urn);
return View(model);
}

Expand All @@ -60,8 +60,7 @@ public async Task<IActionResult> KS4(
CancellationToken ct)
{
var admissionsDetails = await admissionsService.GetAdmissionsDetailsAsync(urn, ct);
var isPrimaryFeatureEnabled = await featureManager.IsEnabledAsync(Constants.Constants.EnablePrimary);
var model = AdmissionsViewModel.MapFrom(admissionsDetails, urn, isPrimaryFeatureEnabled);
var model = AdmissionsViewModel.MapFrom(admissionsDetails, urn);
return View(model);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ public async Task<IActionResult> KS4(
string urn, string schoolName, CancellationToken ct)
{
var establishmentDetails = await establishmentService.GetEstablishmentAsync(urn, ct);
var isPrimaryFeatureEnabled = await featureManager.IsEnabledAsync(Constants.Constants.EnablePrimary);
var model = ViewModels.KS4.CurriculumAndExtraCurricularActivitiesViewModel.Map(establishmentDetails, isPrimaryFeatureEnabled);
var model = ViewModels.KS4.CurriculumAndExtraCurricularActivitiesViewModel.Map(establishmentDetails);
return View(model);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public class AboutSchoolViewModel : ProfileBaseViewModel
private const string SENUnit = "SEN unit";
private const string ResourcedProvisionAndSENUnit = "Resourced provision and SEN unit";
private const string ResourcedProvisionText = "Resourced provision";
private const int LocalAuthorityEstablishmentGroupTypeId = 4;
private const int AcademyOpenReasonId = 10;

public record School(string Name, double Lat, double Lon);
Expand Down Expand Up @@ -79,6 +78,11 @@ public record School(string Name, double Lat, double Lon);

public string? EducationPhase { get; set; }

public required DisplayField<string> KS2WraparoundCare { get; set; }

public required DisplayField<bool> FreeBreakfastClubProgramme { get; set; }

public required DisplayField<bool> HasNurseryProvision { get; set; }

public static AboutSchoolViewModel Map(AboutSchoolModel schoolDetails)
{
Expand Down Expand Up @@ -117,6 +121,9 @@ public static AboutSchoolViewModel Map(AboutSchoolModel schoolDetails)
Predecessors = schoolDetails.Predecessors?.Select(p => SuccessorOrPredecessorDetailsModel.Map(p)).ToList(),
Successors = schoolDetails.Successors?.Select(s => SuccessorOrPredecessorDetailsModel.Map(s)).ToList(),
EducationPhase = EducationPhaseFormatter.Format(schoolDetails.IsKS2, schoolDetails.IsKS4, schoolDetails.IsKS5),
KS2WraparoundCare = schoolDetails.KS2WraparoundCare.ToDisplayField(),
FreeBreakfastClubProgramme = schoolDetails.FreeBreakfastClubProgramme.ToDisplayField(),
HasNurseryProvision = schoolDetails.HasNurseryProvision.ToDisplayField(),
IsKS2 = schoolDetails.IsKS2,
IsKS4 = schoolDetails.IsKS4,
IsKS5 = schoolDetails.IsKS5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@ public class AdmissionsViewModel : BaseViewModel

public bool IsSchoolClosed { get; init; }

public bool IsIndependentSchool { get; init; }
public bool IsPrimaryFeatureEnabled { get; set; }
// Computed property - show sub-navigation only when school has both KS2 & KS4 AND primary feature is enabled
public bool ShowSubNavigation => IsKS2 && IsKS4 && IsPrimaryFeatureEnabled;
public bool IsIndependentSchool { get; init; }

public static AdmissionsViewModel MapFrom(AdmissionsServiceModel serviceModel, string urn, bool isPrimaryFeatureEnabled)
public static AdmissionsViewModel MapFrom(AdmissionsServiceModel serviceModel, string urn)
{
return new AdmissionsViewModel
{
Expand All @@ -33,8 +30,7 @@ public static AdmissionsViewModel MapFrom(AdmissionsServiceModel serviceModel, s
IsIndependentSchool = serviceModel.IsIndependentSchool,
IsKS2 = serviceModel.IsKS2,
IsKS4 = serviceModel.IsKS4,
IsKS5 = serviceModel.IsKS5,
IsPrimaryFeatureEnabled = isPrimaryFeatureEnabled
IsKS5 = serviceModel.IsKS5
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@ namespace SAPPub.Web.Areas.Profiles.ViewModels.KS4;
public class CurriculumAndExtraCurricularActivitiesViewModel : BaseViewModel
{
public required DisplayField<string> SchoolWebsite { get; set; }
public bool IsPrimaryFeatureEnabled { get; set; }

// Computed property - show sub-navigation only when school has both KS2 & KS4 AND primary feature is enabled
public bool ShowSubNavigation => IsKS2 && IsKS4 && IsPrimaryFeatureEnabled;

public static CurriculumAndExtraCurricularActivitiesViewModel Map(EstablishmentServiceModel establishment, bool isPrimaryFeatureEnabled)
public static CurriculumAndExtraCurricularActivitiesViewModel Map(EstablishmentServiceModel establishment)
{
return new CurriculumAndExtraCurricularActivitiesViewModel
{
Expand All @@ -21,8 +17,7 @@ public static CurriculumAndExtraCurricularActivitiesViewModel Map(EstablishmentS
SchoolWebsite = establishment.Website.ToDisplayField(),
IsKS2 = establishment.IsKS2,
IsKS4 = establishment.IsKS4,
IsKS5 = establishment.IsKS5,
IsPrimaryFeatureEnabled = isPrimaryFeatureEnabled
IsKS5 = establishment.IsKS5
};
}
}
50 changes: 49 additions & 1 deletion SAPPub.Web/Areas/Profiles/Views/About/AboutSchool.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,56 @@
</p>
</govuk-details-text>
</govuk-details>
<feature name="EnablePrimary">
@if (Model.IsKS2)
{
<h3 class="govuk-heading-m">Primary school features</h3>
<govuk-summary-list id="primary-school-features-summary">
<govuk-summary-list-row>
<govuk-summary-list-row-key>Nursery</govuk-summary-list-row-key>
<govuk-summary-list-row-value>
@Model.HasNurseryProvision.DisplayText(formatter: value => value ? Yes : NotAvailable)
</govuk-summary-list-row-value>
</govuk-summary-list-row>
<govuk-summary-list-row>
<govuk-summary-list-row-key>Free breakfast club programme</govuk-summary-list-row-key>
<govuk-summary-list-row-value>
@Model.FreeBreakfastClubProgramme.DisplayText(formatter: value => value ? Yes : NotAvailable)
</govuk-summary-list-row-value>
</govuk-summary-list-row>
<govuk-summary-list-row>
<govuk-summary-list-row-key>Wraparound care</govuk-summary-list-row-key>
<govuk-summary-list-row-value>
@Model.KS2WraparoundCare.DisplayText(notAvailableText: NotRecorded)
</govuk-summary-list-row-value>
</govuk-summary-list-row>
</govuk-summary-list>
<govuk-details id="details-primary-features">
<govuk-details-summary>
What is wraparound care and the free breakfast club programme?
</govuk-details-summary>
<govuk-details-text>
<h4 class="govuk-heading-s">Wraparound care</h4>
<p class="govuk-body">Wraparound childcare is before and after school care for primary school aged children in England during term time delivered on or near the school site.</p>
<p class="govuk-body">
Wraparound care is different from out-of-school activities, or school clubs, which are less frequent and can be a one-off activity.
</p>
<p class="govuk-body">Contact the school for more information about what they provide.</p>


<h4 class="govuk-heading-s">Free breakfast club programme</h4>
<p class="govuk-body">The free breakfast club programme is a government-funded initiative being introduced in all state-funded schools with primary-aged children in England. Schools will join the programme in stages between 2026 and 2028.</p>
<p class="govuk-body">These clubs are:</p>
<ul>
<li>open to all pupils on roll at the school in reception to year 6</li>
<li>at least 30 minutes in duration, immediately before the start of each compulsory school day</li>
<li>free to access</li>
<li>offering a breakfast that adheres to the school food standards for England</li>
<li>on, or in the vicinity of, the school site</li>
</ul>
</govuk-details-text>
</govuk-details>
}
</feature>

@if (Model.IsExclusivelyKS5)
{
Expand Down
2 changes: 1 addition & 1 deletion SAPPub.Web/Areas/Profiles/Views/Admissions/KS2.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{
URN = Model.URN,
SchoolName = Model.SchoolName,
ActivePage = RouteConstants.PrimaryAdmissions,
ActivePage = RouteConstants.AdmissionsRoot,
IsKS2 = Model.IsKS2,
IsKS4 = Model.IsKS4,
IsKS5 = Model.IsKS5
Expand Down
8 changes: 5 additions & 3 deletions SAPPub.Web/Areas/Profiles/Views/Admissions/KS4.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{
URN = Model.URN,
SchoolName = Model.SchoolName,
ActivePage = RouteConstants.SecondaryAdmissions,
ActivePage = RouteConstants.AdmissionsRoot,
IsKS2 = Model.IsKS2,
IsKS4 = Model.IsKS4,
IsKS5 = Model.IsKS5
Expand All @@ -24,9 +24,10 @@
<div class="govuk-grid-column-three-quarters">
<span id="school-name-caption" class="govuk-caption-xl">@Model.SchoolName</span>
<h1 class="govuk-heading-xl">@ViewData["Header"]</h1>
@if (Model.ShowSubNavigation)
<feature name="EnablePrimary">
@if (Model.IsKS2)
{
<nav id="sub-navigation-academic-performance" class="moj-sub-navigation" aria-label="Sub navigation">
<nav id="sub-navigation-admissions" class="moj-sub-navigation" aria-label="Sub navigation">
<ul class="moj-sub-navigation__list">
<li class="moj-sub-navigation__item">
<a class="moj-sub-navigation__link" asp-route="@RouteConstants.PrimaryAdmissions" asp-all-route-data="@Model.RouteAttributes">@PageTitleConstants.PrimarySchoolPageTitles.Admissions</a>
Expand All @@ -37,6 +38,7 @@
</ul>
</nav>
}
</feature>
<h2 class="govuk-heading-l">Moving from primary to secondary school</h2>
<div class="govuk-summary-card" data-testid="starting-secondary-school-summary">
<div class="govuk-summary-card__title-wrapper">
Expand Down
2 changes: 1 addition & 1 deletion SAPPub.Web/Areas/Profiles/Views/Curriculum/KS2.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{
URN = Model.URN,
SchoolName = Model.SchoolName,
ActivePage = RouteConstants.PrimaryCurriculum,
ActivePage = RouteConstants.CurriculumRoot,
IsKS2 = Model.IsKS2,
IsKS4 = Model.IsKS4,
IsKS5 = Model.IsKS5
Expand Down
6 changes: 4 additions & 2 deletions SAPPub.Web/Areas/Profiles/Views/Curriculum/KS4.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{
URN = Model.URN,
SchoolName = Model.SchoolName,
ActivePage = RouteConstants.SecondaryCurriculumAndExtraCurricularActivities,
ActivePage = RouteConstants.CurriculumRoot,
IsKS2 = Model.IsKS2,
IsKS4 = Model.IsKS4,
IsKS5 = Model.IsKS5
Expand All @@ -24,7 +24,8 @@
<div class="govuk-grid-column-three-quarters">
<span id="school-name-caption" class="govuk-caption-xl">@Model.SchoolName</span>
<h1 class="govuk-heading-xl">@ViewData["Header"]</h1>
@if (Model.ShowSubNavigation)
<feature name="EnablePrimary">
@if (Model.IsKS2)
{
<nav id="sub-navigation-academic-performance" class="moj-sub-navigation" aria-label="Sub navigation">
<ul class="moj-sub-navigation__list">
Expand All @@ -37,6 +38,7 @@
</ul>
</nav>
}
</feature>

<h2 class="govuk-heading-l">Curriculum</h2>
<div id="current-curriculum-summary" data-testId="current-curriculum-summary" class="govuk-summary-card">
Expand Down
11 changes: 11 additions & 0 deletions SAPPub.Web/Helpers/DisplayField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,15 @@ private static string FormatValue(
_ => formatter?.Invoke(value) ?? value?.ToString() ?? string.Empty
};
}

public string DisplayBool(string trueText = "Yes", string falseText = "Not available")
{
return Status switch
{
FieldStatus.Available when Value is bool boolValue => boolValue ? trueText : falseText,
FieldStatus.Available => falseText,
FieldStatus.NotAvailable => falseText,
_ => falseText
};
}
}
28 changes: 8 additions & 20 deletions SAPPub.Web/ViewComponents/VerticalNavigation/Default.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,19 @@
</a>
</li>

@if (await FeatureManager.IsEnabledAsync(EnablePrimary) && Model.IsKS2)
@if ((await FeatureManager.IsEnabledAsync(EnablePrimary) && Model.IsKS2) || Model.IsKS4)
{
<li class="moj-side-navigation__item @(Model.ActivePage == RouteConstants.PrimaryAdmissions ? "moj-side-navigation__item--active" : "")">
<a asp-route="@RouteConstants.PrimaryAdmissions" asp-all-route-data="routeAttributes">Admissions</a>
<li class="moj-side-navigation__item @(Model.ActivePage == RouteConstants.AdmissionsRoot ? "moj-side-navigation__item--active" : "")">
<a asp-route="@RouteConstants.AdmissionsRoot" asp-all-route-data="routeAttributes">Admissions</a>
</li>
}
else if (Model.IsKS4)
{
<li class="moj-side-navigation__item @(Model.ActivePage == RouteConstants.SecondaryAdmissions ? "moj-side-navigation__item--active" : "")">
<a asp-route="@RouteConstants.SecondaryAdmissions" asp-all-route-data="routeAttributes">Admissions</a>
</li>
}
}

@if (await FeatureManager.IsEnabledAsync(EnablePrimary) && Model.IsKS2)
@if ((await FeatureManager.IsEnabledAsync(EnablePrimary) && Model.IsKS2) || Model.IsKS4)
{
<li class="moj-side-navigation__item @(Model.ActivePage == RouteConstants.PrimaryCurriculum ? "moj-side-navigation__item--active" : "")">
<a asp-route="@RouteConstants.PrimaryCurriculum" asp-all-route-data="routeAttributes">Curriculum and extra-curricular activities</a>
<li class="moj-side-navigation__item @(Model.ActivePage == RouteConstants.CurriculumRoot ? "moj-side-navigation__item--active" : "")">
<a asp-route="@RouteConstants.CurriculumRoot" asp-all-route-data="routeAttributes">Curriculum and extra-curricular activities</a>
</li>
}
else if (Model.IsKS4)
{
<li class="moj-side-navigation__item @(Model.ActivePage == RouteConstants.SecondaryCurriculumAndExtraCurricularActivities ? "moj-side-navigation__item--active" : "")">
<a asp-route="@RouteConstants.SecondaryCurriculumAndExtraCurricularActivities" asp-all-route-data="routeAttributes">Curriculum and extra-curricular activities</a>
</li>
}
}

@if (await FeatureManager.IsEnabledAsync(EnablePrimary) && Model.IsKS2 || Model.IsKS4)
{
Expand Down
Loading
Loading