Skip to content

Commit

Permalink
Merge pull request #601 from DFE-Digital/navigation-iteration-1-feature
Browse files Browse the repository at this point in the history
Feature Navigation iteration 1
  • Loading branch information
nwarms authored Nov 13, 2024
2 parents 80edf42 + 5812d89 commit 420e2f5
Show file tree
Hide file tree
Showing 57 changed files with 1,038 additions and 1,162 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Updated wording for links on the landing page to tell users they open in new tabs
- Updated the ofsted ratings to collect information about the ofsted subgrades
- Remove the edit contact feature flag
- Change Trust Navigation from side nav to top nav (service navigation component)
- Update the Govuk frontend package to ^5.7.1
- Moved breadcrumbs into the trust banner
- Merged Trust details page into Trust Overview page
- Redirect successful search to Overview page
- Removed Ofsted summary card from Trust Overview

## [Release-11][release-11] (production-2024-10-17.3654)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,47 +176,23 @@ public async Task<int> GetNumberOfAcademiesInTrustAsync(string uid)
.FirstOrDefaultAsync();
}

public async Task<AcademyOverview[]> GetAcademiesInTrustOverviewAsync(string uid)
public async Task<AcademyOverview[]> GetOverviewOfAcademiesInTrustAsync(string uid)
{
var academiesData = await academiesDbContext.GiasGroupLinks
return await academiesDbContext.GiasGroupLinks
.Where(gl => gl.GroupUid == uid)
.Join(
academiesDbContext.GiasEstablishments,
gl => gl.Urn!,
e => e.Urn.ToString(),
(gl, e) => new
{
Urn = e.Urn.ToString(),
LocalAuthority = e.LaName,
NumberOfPupils = e.NumberOfPupils.ParseAsNullableInt(),
SchoolCapacity = e.SchoolCapacity.ParseAsNullableInt()
})
.ToListAsync();

// Get URNs as ints
var urns = academiesData.Select(a => int.Parse(a.Urn)).ToArray();

// Fetch Ofsted ratings
var ofstedRatingsDict = await GetOfstedRatings(urns);

var academiesOverview = academiesData.Select(a =>
{
var currentOfstedRating = OfstedRatingScore.None;
if (ofstedRatingsDict.TryGetValue(a.Urn, out var ofstedRatings))
{
currentOfstedRating = ofstedRatings.Current?.OverallEffectiveness ?? OfstedRatingScore.None;
}
return new AcademyOverview(
a.Urn,
a.LocalAuthority ?? string.Empty,
a.NumberOfPupils,
a.SchoolCapacity,
currentOfstedRating
);
}).ToArray();

return academiesOverview;
(gl, e) =>
new AcademyOverview
(
e.Urn.ToString(),
e.LaName ?? string.Empty,
e.NumberOfPupils.ParseAsNullableInt(),
e.SchoolCapacity.ParseAsNullableInt()
))
.ToArrayAsync();
}

private sealed record AcademyOfstedRatings(int Urn, OfstedRating Current, OfstedRating Previous);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class TrustRepository(IAcademiesDbContext academiesDbContext) : ITrustRep
return details is null ? null : new TrustSummary(details.Name, details.Type);
}

public async Task<TrustDetails> GetTrustDetailsAsync(string uid)
public async Task<TrustOverview> GetTrustOverviewAsync(string uid)
{
var giasGroup = await academiesDbContext.Groups
.Where(g => g.GroupUid == uid)
Expand All @@ -39,9 +39,9 @@ public async Task<TrustDetails> GetTrustDetailsAsync(string uid)

var regionAndTerritory = await GetRegionAndTerritoryAsync(uid);

var trustDetailsDto = new TrustDetails(
var trustOverview = new TrustOverview(
giasGroup.GroupUid!, //Searched by this field so it must be present
giasGroup.GroupId,
giasGroup.GroupId!, //Enforced by EF filter
giasGroup.Ukprn,
giasGroup.CompaniesHouseNumber,
giasGroup.GroupType!, //Enforced by EF filter
Expand All @@ -56,7 +56,7 @@ public async Task<TrustDetails> GetTrustDetailsAsync(string uid)
giasGroup.IncorporatedOnOpenDate.ParseAsNullableDate()
);

return trustDetailsDto;
return trustOverview;
}

public async Task<TrustGovernance> GetTrustGovernanceAsync(string uid, string? urn = null)
Expand Down Expand Up @@ -84,6 +84,7 @@ public async Task<TrustGovernance> GetTrustGovernanceAsync(string uid, string? u

return governersDto;
}

public static IQueryable<GiasGovernance> FilterBySatOrMat(string uid, string? urn, IQueryable<GiasGovernance> query)
{
if (!string.IsNullOrEmpty(urn))
Expand Down Expand Up @@ -160,5 +161,4 @@ private async Task<Dictionary<string, Person>> GetGovernanceContactsAsync(string
governorEmails.SingleOrDefault(governorEmail => governorEmail.Gid == governor.Gid)?.Email)
);
}

}
7 changes: 7 additions & 0 deletions DfE.FindInformationAcademiesTrusts.Data/Enums/TrustType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace DfE.FindInformationAcademiesTrusts.Data.Enums;

public enum TrustType
{
SingleAcademyTrust,
MultiAcademyTrust
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ public record AcademyOverview(
string Urn,
string LocalAuthority,
int? NumberOfPupils,
int? SchoolCapacity,
OfstedRatingScore CurrentOfstedRating
int? SchoolCapacity
);
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ public interface IAcademyRepository
Task<AcademyOfsted[]> GetAcademiesInTrustOfstedAsync(string uid);
Task<AcademyPupilNumbers[]> GetAcademiesInTrustPupilNumbersAsync(string uid);
Task<AcademyFreeSchoolMeals[]> GetAcademiesInTrustFreeSchoolMealsAsync(string uid);
Task<AcademyOverview[]> GetAcademiesInTrustOverviewAsync(string uid);
Task<AcademyOverview[]> GetOverviewOfAcademiesInTrustAsync(string uid);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace DfE.FindInformationAcademiesTrusts.Data.Repositories.Trust;
public interface ITrustRepository
{
Task<TrustSummary?> GetTrustSummaryAsync(string uid);
Task<TrustDetails> GetTrustDetailsAsync(string uid);
Task<TrustOverview> GetTrustOverviewAsync(string uid);
Task<TrustGovernance> GetTrustGovernanceAsync(string uid, string? urn = null);
Task<TrustContacts> GetTrustContactsAsync(string uid, string? urn = null);
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace DfE.FindInformationAcademiesTrusts.Data.Repositories.Trust;

public record TrustDetails(
public record TrustOverview(
string Uid,
string? GroupId,
string GroupId,
string? Ukprn,
string? CompaniesHouseNumber,
string Type,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
using DfE.FindInformationAcademiesTrusts.Services.Trust;
using DfE.FindInformationAcademiesTrusts.Data.Enums;

namespace DfE.FindInformationAcademiesTrusts.Pages;

public interface IOtherServicesLinkBuilder
{
string? CompaniesHouseListingLink(string? companiesHouseNumber);
string? FindSchoolPerformanceDataListingLink(string uid, TrustType trustType, string? satAcademyUrn);
string GetInformationAboutSchoolsListingLinkForTrust(string trustUid);
string GetInformationAboutSchoolsListingLinkForAcademy(string urn);
string? CompaniesHouseListingLink(TrustDetailsServiceModel trust);
string? SchoolFinancialBenchmarkingServiceListingLink(TrustDetailsServiceModel trust);
string? FindSchoolPerformanceDataListingLink(TrustDetailsServiceModel trust);

string? SchoolFinancialBenchmarkingServiceListingLink(TrustType trustType, string? satAcademyUrn,
string? companiesHouseNumber);
}

public class OtherServicesLinkBuilder : IOtherServicesLinkBuilder
Expand All @@ -34,39 +36,34 @@ public string GetInformationAboutSchoolsListingLinkForAcademy(string urn)
return $"{GetInformationAboutSchoolsBaseUrl}/Establishments/Establishment/Details/{urn}";
}

public string? CompaniesHouseListingLink(TrustDetailsServiceModel trust)
public string? CompaniesHouseListingLink(string? companiesHouseNumber)
{
if (string.IsNullOrEmpty(trust.CompaniesHouseNumber)) return null;
return $"{CompaniesHouseBaseUrl}/company/{trust.CompaniesHouseNumber}";
return string.IsNullOrEmpty(companiesHouseNumber)
? null
: $"{CompaniesHouseBaseUrl}/company/{companiesHouseNumber}";
}

public string? SchoolFinancialBenchmarkingServiceListingLink(TrustDetailsServiceModel trust)
public string? SchoolFinancialBenchmarkingServiceListingLink(TrustType trustType, string? satAcademyUrn,
string? companiesHouseNumber)
{
if (trust.IsMultiAcademyTrust())
{
return $"{SchoolFinancialBenchmarkingServiceBaseUrl}/Trust?companyNo={trust.CompaniesHouseNumber}";
}

if (trust.IsSingleAcademyTrust() && trust.SingleAcademyTrustAcademyUrn is not null)
return trustType switch
{
return $"{SchoolFinancialBenchmarkingServiceBaseUrl}/school?urn={trust.SingleAcademyTrustAcademyUrn}";
}

return null;
TrustType.MultiAcademyTrust when companiesHouseNumber is not null =>
$"{SchoolFinancialBenchmarkingServiceBaseUrl}/Trust?companyNo={companiesHouseNumber}",
TrustType.SingleAcademyTrust when satAcademyUrn is not null =>
$"{SchoolFinancialBenchmarkingServiceBaseUrl}/school?urn={satAcademyUrn}",
_ => null
};
}

public string? FindSchoolPerformanceDataListingLink(TrustDetailsServiceModel trust)
public string? FindSchoolPerformanceDataListingLink(string uid, TrustType trustType, string? satAcademyUrn)
{
if (trust.IsMultiAcademyTrust())
return trustType switch
{
return $"{FindSchoolPerformanceDataBaseUrl}/multi-academy-trust/{trust.Uid}";
}

if (trust.IsSingleAcademyTrust() && trust.SingleAcademyTrustAcademyUrn is not null)
{
return $"{FindSchoolPerformanceDataBaseUrl}/school/{trust.SingleAcademyTrustAcademyUrn}";
}

return null;
TrustType.MultiAcademyTrust => $"{FindSchoolPerformanceDataBaseUrl}/multi-academy-trust/{uid}",
TrustType.SingleAcademyTrust when satAcademyUrn is not null =>
$"{FindSchoolPerformanceDataBaseUrl}/school/{satAcademyUrn}",
_ => null
};
}
}
2 changes: 1 addition & 1 deletion DfE.FindInformationAcademiesTrusts/Pages/Search.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
@foreach (var trust in Model.Trusts)
{
<li class="govuk-!-margin-bottom-6" data-testid="trust-result">
<a asp-page="./Trusts/Details" asp-route-uid="@trust.Uid" class="govuk-!-font-weight-bold govuk-link govuk-!-font-size-24" data-testid="trust-name">@Html.DisplayFor(modelItem => trust.Name)</a>
<a asp-page="./Trusts/Overview" asp-route-uid="@trust.Uid" class="govuk-!-font-weight-bold govuk-link govuk-!-font-size-24" data-testid="trust-name">@Html.DisplayFor(modelItem => trust.Name)</a>
<dl class="govuk-summary-list govuk-summary-list--no-border app-search-results-summary-list">
<div class="govuk-summary-list__row govuk-body app-search-results-summary-list__row">
<dt class="govuk-summary-list__key app-search-results-summary-list__key app-search-results-summary-list__item">
Expand Down
2 changes: 1 addition & 1 deletion DfE.FindInformationAcademiesTrusts/Pages/Search.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public async Task<IActionResult> OnGetAsync()
var trust = await _trustService.GetTrustSummaryAsync(Uid);
if (trust != null && string.Equals(trust.Name, KeyWords, StringComparison.CurrentCultureIgnoreCase))
{
return RedirectToPage("/Trusts/Details", new { Uid });
return RedirectToPage("/Trusts/Overview", new { Uid });
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@

<ul class="moj-sub-navigation__list">
<li class="moj-sub-navigation__item">
<a id="academies-details-link" class="moj-sub-navigation__link" aria-current="@GetAriaCurrentIf("Details")" asp-page="./Details" asp-route-uid="@Model.TrustSummary.Uid"><span class="visually-hidden">Academies</span>Details</a>
<a id="academies-details-link" class="moj-sub-navigation__link" aria-current="@GetAriaCurrentIf("Details")" asp-page="./Details" asp-route-uid="@Model.TrustSummary.Uid"><span class="visually-hidden">Academies </span>Details</a>
</li>

<li class="moj-sub-navigation__item">
<a id="ofsted-ratings-link" class="moj-sub-navigation__link" aria-current="@GetAriaCurrentIf("Ofsted ratings")" asp-page="./OfstedRatings" asp-route-uid="@Model.TrustSummary.Uid"><span class="visually-hidden">Academies</span>Ofsted ratings</a>
<a id="ofsted-ratings-link" class="moj-sub-navigation__link" aria-current="@GetAriaCurrentIf("Ofsted ratings")" asp-page="./OfstedRatings" asp-route-uid="@Model.TrustSummary.Uid"><span class="visually-hidden">Academies </span>Ofsted ratings</a>
</li>

<li class="moj-sub-navigation__item">
<a id="academies-pupil-numbers-link" class="moj-sub-navigation__link" aria-current="@GetAriaCurrentIf("Pupil numbers")" asp-page="./PupilNumbers" asp-route-uid="@Model.TrustSummary.Uid"><span class="visually-hidden">Academies</span>Pupil numbers</a>
<a id="academies-pupil-numbers-link" class="moj-sub-navigation__link" aria-current="@GetAriaCurrentIf("Pupil numbers")" asp-page="./PupilNumbers" asp-route-uid="@Model.TrustSummary.Uid"><span class="visually-hidden">Academies </span>Pupil numbers</a>
</li>

<li class="moj-sub-navigation__item">
<a id="free-school-meals-link" class="moj-sub-navigation__link" aria-current="@GetAriaCurrentIf("Free school meals")" asp-page="./FreeSchoolMeals" asp-route-uid="@Model.TrustSummary.Uid"><span class="visually-hidden">Academies</span>Free school meals</a>
<a id="free-school-meals-link" class="moj-sub-navigation__link" aria-current="@GetAriaCurrentIf("Free school meals")" asp-page="./FreeSchoolMeals" asp-route-uid="@Model.TrustSummary.Uid"><span class="visually-hidden">Academies </span>Free school meals</a>
</li>
</ul>

Expand Down
Loading

0 comments on commit 420e2f5

Please sign in to comment.