Skip to content

Commit

Permalink
Merge pull request #966 from DFE-Digital/feature/150257-school-overview
Browse files Browse the repository at this point in the history
Feature/150257 school overview
  • Loading branch information
dneed-nimble authored Jan 8, 2024
2 parents 2f32d8a + 32cf73d commit ba16fb2
Show file tree
Hide file tree
Showing 27 changed files with 445 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Dfe.PrepareConversions.Data.Models;
using Dfe.PrepareConversions.Data.Services;
using Microsoft.FeatureManagement;
using System.Dynamic;
using System.Net.Http;
using System.Net.Http.Json;
using System.Threading.Tasks;
Expand Down Expand Up @@ -70,6 +69,28 @@ public async Task<HttpResponseMessage> SetProjectExternalApplicationForm(int id,

return await AcademisationClient.PutAsync(string.Format(PathFor.SetExternalApplicationForm, id), JsonContent.Create(payload));
}
public async Task<HttpResponseMessage> SetSchoolOverview(int id, SetSchoolOverviewModel updatedSchoolOverview)
{
var payload = new
{
id = updatedSchoolOverview.Id,
publishedAdmissionNumber = updatedSchoolOverview.PublishedAdmissionNumber ?? string.Empty,
viabilityIssues = updatedSchoolOverview.ViabilityIssues ?? string.Empty,
partOfPfiScheme = updatedSchoolOverview.PartOfPfiScheme ?? string.Empty,
financialDeficit = updatedSchoolOverview.FinancialDeficit ?? string.Empty,
numberOfPlacesFundedFor = updatedSchoolOverview.NumberOfPlacesFundedFor ?? null,
numberOfResidentialPlaces = updatedSchoolOverview.NumberOfResidentialPlaces ?? null,
numberOfFundedResidentialPlaces = updatedSchoolOverview.NumberOfFundedResidentialPlaces ?? null,
pfiSchemeDetails = updatedSchoolOverview.PfiSchemeDetails ?? string.Empty,
distanceFromSchoolToTrustHeadquarters = updatedSchoolOverview.DistanceFromSchoolToTrustHeadquarters ?? 0,
distanceFromSchoolToTrustHeadquartersAdditionalInformation = updatedSchoolOverview.DistanceFromSchoolToTrustHeadquartersAdditionalInformation ?? string.Empty,
memberOfParliamentNameAndParty = updatedSchoolOverview.MemberOfParliamentNameAndParty ?? string.Empty
};

var formattedString = string.Format(PathFor.SetSchoolOverview, id);
return await AcademisationClient.PutAsync(formattedString, JsonContent.Create(payload));
}


public async Task<HttpResponseMessage> GetAllProjectsV2Async(AcademyConversionSearchModelV2 searchModel)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ public interface IApiClient
Task<HttpResponseMessage> AddProjectNote(int id, AddProjectNote projectNote);

Task<HttpResponseMessage> SetProjectExternalApplicationForm(int id, bool externalApplicationFormSaved, string externalApplicationFormUrl);
Task<HttpResponseMessage> SetSchoolOverview(int id, SetSchoolOverviewModel updatedSchoolOverview);
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public PathFor(IFeatureManager features)
public static string GetFilterParameters => "/legacy/projects/status";
public static string AddProjectNote => "/legacy/project/{0}/notes";
public static string SetExternalApplicationForm => "/conversion-project/{0}/setExternalApplicationForm";
public static string SetSchoolOverview => "/conversion-project/{0}/SetSchoolOverview";

public static string GetAllProjectsV2 => "/conversion-project/projects";
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ public class AcademyConversionProject
public string PartOfPfiScheme { get; set; }
public string PfiSchemeDetails { get; set; }
public string ViabilityIssues { get; set; }
public decimal? NumberOfPlacesFundedFor { get; set; }
public decimal? NumberOfResidentialPlaces { get; set; }
public decimal? NumberOfFundedResidentialPlaces { get; set; }
public string FinancialDeficit { get; set; }
public decimal? DistanceFromSchoolToTrustHeadquarters { get; set; }
public string DistanceFromSchoolToTrustHeadquartersAdditionalInformation { get; set; }
Expand Down Expand Up @@ -120,5 +123,5 @@ public class AcademyConversionProject

// notes
public ICollection<ProjectNote> Notes { get; set; } = new List<ProjectNote>();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
namespace Dfe.PrepareConversions.Data.Models
{
public class SetSchoolOverviewModel
{
public int Id { get; set; }
public string PublishedAdmissionNumber { get; set; }
public string ViabilityIssues { get; set; }
public string FinancialDeficit { get; set; }
public decimal? NumberOfPlacesFundedFor { get; set; }
public decimal? NumberOfResidentialPlaces { get; set; }
public decimal? NumberOfFundedResidentialPlaces { get; set; }
public string PartOfPfiScheme { get; set; }
public string PfiSchemeDetails { get; set; }
public decimal? DistanceFromSchoolToTrustHeadquarters { get; set; }
public string DistanceFromSchoolToTrustHeadquartersAdditionalInformation { get; set; }
public string MemberOfParliamentNameAndParty { get; set; }

public SetSchoolOverviewModel() { }

public SetSchoolOverviewModel(
int id,
string publishedAdmissionNumber,
string viabilityIssues,
string financialDeficit,
decimal? numberOfPlacesFundedFor,
decimal? numberOfResidentialPlaces,
decimal? numberOfFundedResidentialPlaces,
string partOfPfiScheme,
string pfiSchemeDetails,
decimal? distanceFromSchoolToTrustHeadquarters,
string distanceFromSchoolToTrustHeadquartersAdditionalInformation,
string memberOfParliamentNameAndParty)
{
Id = id;
PublishedAdmissionNumber = publishedAdmissionNumber;
ViabilityIssues = viabilityIssues;
FinancialDeficit = financialDeficit;
NumberOfPlacesFundedFor = numberOfPlacesFundedFor;
NumberOfResidentialPlaces = numberOfResidentialPlaces;
NumberOfFundedResidentialPlaces = numberOfFundedResidentialPlaces;
PartOfPfiScheme = partOfPfiScheme;
PfiSchemeDetails = pfiSchemeDetails;
DistanceFromSchoolToTrustHeadquarters = distanceFromSchoolToTrustHeadquarters;
DistanceFromSchoolToTrustHeadquartersAdditionalInformation = distanceFromSchoolToTrustHeadquartersAdditionalInformation;
MemberOfParliamentNameAndParty = memberOfParliamentNameAndParty;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public class UpdateAcademyConversionProject
// School Overview
public string PublishedAdmissionNumber { get; set; }
public string ViabilityIssues { get; set; }
public decimal? NumberOfPlacesFundedFor { get; set; }
public decimal? NumberOfResidentialPlaces { get; set; }
public decimal? NumberOfFundedResidentialPlaces { get; set; }
public string FinancialDeficit { get; set; }
public bool? IsThisADiocesanTrust { get; set; }
public string PartOfPfiScheme { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,11 @@ public async Task SetProjectExternalApplicationForm(int id, bool externalApplica
HttpResponseMessage result = await _apiClient.SetProjectExternalApplicationForm(id, externalApplicationFormSaved, externalApplicationFormUrl);
if (result.IsSuccessStatusCode is false) throw new ApiResponseException($"Request to Api failed | StatusCode - {result.StatusCode}");
}
public async Task SetSchoolOverview(int id, SetSchoolOverviewModel updatedSchoolOverview)
{
HttpResponseMessage result = await _apiClient.SetSchoolOverview(id, updatedSchoolOverview);
if (result.IsSuccessStatusCode is false) throw new ApiResponseException($"Request to Api failed | StatusCode - {result.StatusCode}");
}

public async Task<ApiResponse<ApiV2Wrapper<IEnumerable<AcademyConversionProject>>>> GetAllProjectsV2(int page, int count, string titleFilter = "", IEnumerable<string> statusFilters = null, IEnumerable<string> deliveryOfficerFilter = null, IEnumerable<string> regionsFilter = null, IEnumerable<string> localAuthoritiesFilter = null, IEnumerable<string> advisoryBoardDatesFilter = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Task<ApiResponse<ApiV2Wrapper<IEnumerable<AcademyConversionProject>>>> GetAllPro
Task<ApiResponse<AcademyConversionProject>> UpdateProject(int id, UpdateAcademyConversionProject updateProject);
Task CreateProject(CreateNewProject newProject);
Task SetProjectExternalApplicationForm(int id, bool externalApplicationFormSaved, string externalApplicationFormUrl);
Task SetSchoolOverview(int id, SetSchoolOverviewModel updatedSchoolOverview);
Task<ApiResponse<ProjectFilterParameters>> GetFilterParameters();
Task<ApiResponse<ProjectNote>> AddProjectNote(int id, AddProjectNote addProjectNote);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Dfe.Academisation.ExtensionMethods;
using Dfe.PrepareConversions.Data.Models;
using Dfe.PrepareConversions.Data.Models.KeyStagePerformance;
using Dfe.PrepareConversions.Extensions;
using Dfe.PrepareConversions.Models;
using System;
using System.Linq;
Expand Down Expand Up @@ -94,6 +93,9 @@ public void ItBuildstheSchoolOverviewSuccessfully()
Assert.Equal(_template.PercentageFreeSchoolMeals, $"{_schoolOverview.PercentageFreeSchoolMeals}%");
Assert.Equal(_template.PartOfPfiScheme, _project.PartOfPfiScheme);
Assert.Equal(_template.ViabilityIssues, _project.ViabilityIssues);
Assert.Equal(_template.NumberOfPlacesFundedFor, _project.NumberOfPlacesFundedFor.ToString());
Assert.Equal(_template.NumberOfResidentialPlaces, _project.NumberOfResidentialPlaces.ToString());
Assert.Equal(_template.NumberOfFundedResidentialPlaces, _project.NumberOfFundedResidentialPlaces.ToString());
Assert.Equal(_template.FinancialDeficit, _project.FinancialDeficit);
Assert.Equal(_template.IsSchoolLinkedToADiocese, _schoolOverview.IsSchoolLinkedToADiocese);
Assert.Equal(_template.DistanceFromSchoolToTrustHeadquarters, $"{_project.DistanceFromSchoolToTrustHeadquarters.ToSafeString()} miles");
Expand Down Expand Up @@ -178,6 +180,9 @@ public void ItDealsWithNullValuesWhenPopulatingTheFieldsForTheSchoolOverview()
Assert.Equal("", template.PercentageFreeSchoolMeals);
Assert.Null(template.PartOfPfiScheme);
Assert.Null(template.ViabilityIssues);
Assert.Null(template.NumberOfPlacesFundedFor);
Assert.Null(template.NumberOfResidentialPlaces);
Assert.Null(template.NumberOfFundedResidentialPlaces);
Assert.Null(template.FinancialDeficit);
Assert.Null(template.IsSchoolLinkedToADiocese);
Assert.Null(template.DistanceFromSchoolToTrustHeadquarters);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ public async Task Should_be_not_started_and_display_empty_when_school_overview_n
project.PublishedAdmissionNumber = null;
project.PartOfPfiScheme = "No";
project.PfiSchemeDetails = null;
project.NumberOfPlacesFundedFor = null;
project.NumberOfResidentialPlaces = null;
project.NumberOfFundedResidentialPlaces = null;
project.ViabilityIssues = null;
project.FinancialDeficit = null;
project.DistanceFromSchoolToTrustHeadquarters = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public class AcademyConversionProjectPostModel

[BindProperty(Name = "conversion-support-grant-change-reason")]
[DisplayFormat(ConvertEmptyStringToNull = false)]

public string ConversionSupportGrantChangeReason { get; set; }
[BindProperty(Name = "conversion-support-grant-type")]
[DisplayFormat(ConvertEmptyStringToNull = false)]
Expand All @@ -123,6 +123,12 @@ public class AcademyConversionProjectPostModel

[BindProperty(Name = "viability-issues")]
public string ViabilityIssues { get; set; }
[BindProperty(Name = "number-of-places-funded-for")]
public int? NumberOfPlacesFundedFor { get; set; }
[BindProperty(Name = "number-of-residential-places")]
public int? NumberOResidentialPlaces { get; set; }
[BindProperty(Name = "number-of-funded-residential-places")]
public int? NumberOfFundedResidentialPlaces { get; set; }

[BindProperty(Name = "financial-deficit")]
public string FinancialDeficit { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using Dfe.PrepareConversions.Data.Models;
using Dfe.Academisation.ExtensionMethods;
using Dfe.PrepareConversions.Data.Models;
using Dfe.PrepareConversions.Data.Models.KeyStagePerformance;
using Dfe.PrepareConversions.DocumentGeneration;
using Dfe.PrepareConversions.Extensions;
using Dfe.Academisation.ExtensionMethods;
using Dfe.PrepareConversions.ViewModels;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -109,6 +108,12 @@ public class HtbTemplate

[DocumentText("ViabilityIssues")]
public string ViabilityIssues { get; set; }
[DocumentText("NumberOfPlacesFundedFor")]
public string NumberOfPlacesFundedFor { get; set; }
[DocumentText("NumberOfResidentialPlaces")]
public string NumberOfResidentialPlaces { get; set; }
[DocumentText("NumberOfFundedResidentialPlaces")]
public string NumberOfFundedResidentialPlaces { get; set; }

[DocumentText("FinancialDeficit")]
public string FinancialDeficit { get; set; }
Expand Down Expand Up @@ -254,6 +259,9 @@ public static HtbTemplate Build(AcademyConversionProject project,
PercentageFreeSchoolMeals = !string.IsNullOrEmpty(schoolOverview.PercentageFreeSchoolMeals) ? $"{schoolOverview.PercentageFreeSchoolMeals}%" : "",
PartOfPfiScheme = project.PartOfPfiScheme,
ViabilityIssues = project.ViabilityIssues,
NumberOfPlacesFundedFor = project.NumberOfPlacesFundedFor.ToStringOrDefault(),
NumberOfResidentialPlaces = project.NumberOfResidentialPlaces.ToStringOrDefault(),
NumberOfFundedResidentialPlaces = project.NumberOfFundedResidentialPlaces.ToStringOrDefault(),
FinancialDeficit = project.FinancialDeficit,
IsSchoolLinkedToADiocese = schoolOverview.IsSchoolLinkedToADiocese,
DistanceFromSchoolToTrustHeadquarters = project.DistanceFromSchoolToTrustHeadquarters != null
Expand Down
3 changes: 3 additions & 0 deletions Dfe.PrepareConversions/Dfe.PrepareConversions/Models/Links.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ public static class SchoolOverviewSection
public static readonly LinkItem ConfirmSchoolOverview = AddLinkItem(page: "/TaskList/SchoolOverview/SchoolOverview");
public static readonly LinkItem PublishedAdmissionNumber = AddLinkItem(page: "/TaskList/SchoolOverview/PublishedAdmissionNumber");
public static readonly LinkItem ViabilityIssues = AddLinkItem(page: "/TaskList/SchoolOverview/ViabilityIssues");
public static readonly LinkItem NumberOfPlacesFundedFor = AddLinkItem(page: "/TaskList/SchoolOverview/SENNumberOfPlacesFundedFor");
public static readonly LinkItem NumberOfResidentialPlaces = AddLinkItem(page: "/TaskList/SchoolOverview/SENNumberOfResidentialPlaces");
public static readonly LinkItem NumberOfFundedResidentialPlaces = AddLinkItem(page: "/TaskList/SchoolOverview/SENNumberOfFundedResidentialPlaces");
public static readonly LinkItem FinancialDeficit = AddLinkItem(page: "/TaskList/SchoolOverview/FinancialDeficit");
public static readonly LinkItem DistanceFromTrustHeadquarters = AddLinkItem(page: "/TaskList/SchoolOverview/DistanceFromTrustHeadquarters");
public static readonly LinkItem MPDetails = AddLinkItem(page: "/TaskList/SchoolOverview/MPDetails");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
<govuk-summary-list-row name="published-admission-number" label="Published admission number (PAN)" key-width="@kw" asp-for="PublishedAdmissionNumber" asp-page="@Links.SchoolOverviewSection.PublishedAdmissionNumber.Page" asp-route-id="@Model.Id" hidden-text="published admission numbers"/>
<govuk-summary-list-row name="number-on-roll" label="Number on roll (NOR)" key-width="@kw" asp-for="NumberOnRoll"/>
<govuk-summary-list-row name="percentage-school-full" label="Percentage the school is full" key-width="@kw" asp-for="PercentageSchoolFull"/>
<govuk-summary-list-row if="@Model.IsSpecial" name="number-of-places-funded-for" label="Number of places the school is currently funded for" key-width="@kw" asp-for="NumberOfPlacesFundedFor" asp-page="@Links.SchoolOverviewSection.NumberOfPlacesFundedFor.Page" asp-route-id="@Model.Id" hidden-text="number of places funded for" />
<govuk-summary-list-row if="@Model.IsSpecial" name="number-of-residential-places" label="Number of residential places" key-width="@kw" asp-for="NumberOfResidentialPlaces" asp-page="@Links.SchoolOverviewSection.NumberOfResidentialPlaces.Page" asp-route-id="@Model.Id" hidden-text="number of residential places" />
<govuk-summary-list-row if="@Model.IsSpecial" name="number-of-residental-places-funded-for" label="Number of residential places the school is funded for" key-width="@kw" asp-for="NumberOfFundedResidentialPlaces" asp-page="@Links.SchoolOverviewSection.NumberOfFundedResidentialPlaces.Page" asp-route-id="@Model.Id" hidden-text="number of residential places funded for" />
<govuk-summary-list-row name="percentage-free-school-meals" label="Percentage of free school meals at the school (%FSM)" key-width="@kw" asp-for="PercentageFreeSchoolMeals"/>
<govuk-summary-list-row name="viability-issues" label="Viability issues" key-width="@kw" asp-for="ViabilityIssues" asp-page="@Links.SchoolOverviewSection.ViabilityIssues.Page" asp-route-id="@Model.Id" hidden-text="viability issues"/>
<govuk-summary-list-row name="financial-deficit" label="Financial deficit" key-width="@kw" asp-for="FinancialDeficit" asp-page="@Links.SchoolOverviewSection.FinancialDeficit.Page" asp-route-id="@Model.Id" hidden-text="financial deficit"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@page "/task-list/{id:int}/confirm-school-overview/number-of-funded-residential-places"
@using Dfe.PrepareConversions.TagHelpers
@model Dfe.PrepareConversions.Pages.TaskList.SchoolOverview.SENNumberOfFundedResidentialPlaces
@{
ViewData["Title"] = (ViewData.ModelState.IsValid ? "" : "Error: ") + "Number of funded residential places";
Layout = "_QuestionLayout";
ViewData["ProjectId"] = Model.Project.Id;
ViewData["AcademyTypeAndRoute"] = Model.Project.AcademyTypeAndRoute;
}

@section BeforeMain
{
<govuk-back-link link-item="@Links.SchoolOverviewSection.ConfirmSchoolOverview" />
}

<govuk-text-input heading-label="true" label="How many residential places is the school funded for?" name="number-of-funded-residential-places" asp-for="@Model.NumberOfFundedResidentialPlaces" width="5" hint="For example, 100" />
Loading

0 comments on commit ba16fb2

Please sign in to comment.