Skip to content

Commit

Permalink
Merge pull request #975 from DFE-Digital/feature/147236-PRU_TASK_LIST
Browse files Browse the repository at this point in the history
Feature/147236 pru task list
  • Loading branch information
paullocknimble authored Jan 24, 2024
2 parents 35ad2ff + 62df68b commit d6058d4
Show file tree
Hide file tree
Showing 10 changed files with 116 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Dfe.PrepareConversions.Data.Models;
using Dfe.PrepareConversions.Data.Models.KeyStagePerformance;
using Dfe.PrepareConversions.DocumentGeneration;
using Dfe.PrepareConversions.Utils;
using Dfe.PrepareConversions.ViewModels;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -136,6 +137,24 @@ public class HtbTemplate
[DocumentText("MemberOfParliamentNameAndParty")]
public string MemberOfParliamentNameAndParty { get; set; }

[DocumentText("PupilsAttendingGroup")]
public string PupilsAttendingGroup { get; set; }

[DocumentText("NumberOfAlternativeProvisionPlaces")]
public string NumberOfAlternativeProvisionPlaces { get; set; }

[DocumentText("NumberOfMedicalPlaces")]
public string NumberOfMedicalPlaces { get; set; }

[DocumentText("NumberOfPost16Places")]
public string NumberOfPost16Places { get; set; }

[DocumentText("NumberOfSENUnitPlaces")]
public string NumberOfSENUnitPlaces { get; set; }

[DocumentText("ConversionSupportGrantNumberOfSites")]
public string ConversionSupportGrantNumberOfSites { get; set; }

// rationale
[DocumentText("RationaleForProject")]
public string RationaleForProject { get; set; }
Expand Down Expand Up @@ -294,7 +313,13 @@ public static HtbTemplate Build(AcademyConversionProject project,
YearThreeProjectedPupilNumbers = project.YearThreeProjectedPupilNumbers.ToString(),
YearThreePercentageSchoolFull = project.YearThreeProjectedPupilNumbers.AsPercentageOf(project.YearThreeProjectedCapacity),
SchoolPupilForecastsAdditionalInformation = project.SchoolPupilForecastsAdditionalInformation,
SchoolPerformance = schoolPerformance
SchoolPerformance = schoolPerformance,
PupilsAttendingGroup = SchoolOverviewHelper.MapPupilsAttendingGroup(project.PupilsAttendingGroupPermanentlyExcluded, project.PupilsAttendingGroupMedicalAndHealthNeeds, project.PupilsAttendingGroupTeenageMums),
ConversionSupportGrantNumberOfSites = project.ConversionSupportGrantNumberOfSites,
NumberOfAlternativeProvisionPlaces = project.NumberOfAlternativeProvisionPlaces?.ToString(),
NumberOfSENUnitPlaces = project.NumberOfSENUnitPlaces?.ToString(),
NumberOfMedicalPlaces = project.NumberOfMedicalPlaces?.ToString(),
NumberOfPost16Places = project.NumberOfPost16Places?.ToString()
};

if (keyStagePerformance.HasKeyStage2PerformanceTables)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
<govuk-summary-list-row if="@Model.IsDao" name="dao-pack-sent-date" label="Date directive academy order (DAO) pack sent" key-width="@kw" value="@Model.DaoPackSentDate" asp-page="@Links.SchoolAndTrustInformationSection.DaoPackSent.Page" asp-route-id="@Model.Id" />
<govuk-summary-list-row name="academy-type-and-route" label="Academy type and route" key-width="@kw" value="@Model.AcademyTypeAndRoute" asp-route-id="@Model.Id" hidden-text="academy type and route" />
@* Voluntary grant *@
<govuk-summary-list-row if="@Model.AcademyTypeAndRoute.Equals("Converter")" name="grant-funding-amount" label="Grant funding amount" key-width="@kw" value="@Model.ConversionSupportGrantAmount" asp-route-id="@Model.Id" asp-page="@Links.SchoolAndTrustInformationSection.RouteAndGrant.Page" hidden-text="grant funding amount" />
<govuk-summary-list-row if="@Model.AcademyTypeAndRoute.Equals("Converter") && string.IsNullOrEmpty(Model.ConversionSupportGrantChangeReason) != true" name="grant-funding-reason" label="Grant funding reason" key-width="@kw" value="@Model.ConversionSupportGrantChangeReason" asp-route-id="@Model.Id" asp-page="@Links.SchoolAndTrustInformationSection.RouteAndGrant.Page" hidden-text="grant funding reason" />
<govuk-summary-list-row if="@Model.AcademyTypeAndRoute.Equals("Converter") && [email protected] && [email protected]" name="grant-funding-amount" label="Grant funding amount" key-width="@kw" value="@Model.ConversionSupportGrantAmount" asp-route-id="@Model.Id" asp-page="@Links.SchoolAndTrustInformationSection.RouteAndGrant.Page" hidden-text="grant funding amount" />
<govuk-summary-list-row if="@Model.AcademyTypeAndRoute.Equals("Converter") && [email protected] && [email protected] && string.IsNullOrEmpty(Model.ConversionSupportGrantChangeReason) != true" name="grant-funding-reason" label="Grant funding reason" key-width="@kw" value="@Model.ConversionSupportGrantChangeReason" asp-route-id="@Model.Id" asp-page="@Links.SchoolAndTrustInformationSection.RouteAndGrant.Page" hidden-text="grant funding reason" />
@* Sponsored grant *@
<govuk-summary-list-row if="@Model.IsDao" name="grant-funding-type" label="Grant funding type" key-width="@kw" value="@Model.ConversionSupportGrantType" asp-route-id="@Model.Id" asp-page="@Links.SchoolAndTrustInformationSection.GrantType.Page" hidden-text="grant funding type" />
<govuk-summary-list-row if="@Model.IsDao" name="grant-funding-amount" label="Grant funding amount" key-width="@kw" value="@Model.ConversionSupportGrantAmount" asp-route-id="@Model.Id" asp-page="@Links.SchoolAndTrustInformationSection.GrantDetails.Page" hidden-text="grant funding amount" />
<govuk-summary-list-row if="@Model.IsDao || @Model.IsPRU || @Model.IsSEN" name="grant-funding-type" label="Grant funding type" key-width="@kw" value="@Model.ConversionSupportGrantType" asp-route-id="@Model.Id" asp-page="@Links.SchoolAndTrustInformationSection.GrantType.Page" hidden-text="grant funding type" />
<govuk-summary-list-row if="@Model.IsDao || @Model.IsPRU || @Model.IsSEN" name="grant-funding-amount" label="Grant funding amount" key-width="@kw" value="@Model.ConversionSupportGrantAmount" asp-route-id="@Model.Id" asp-page="@Links.SchoolAndTrustInformationSection.GrantDetails.Page" hidden-text="grant funding amount" />
<govuk-summary-list-row if="@Model.IsPRU" name="number-of-sites" label="Number of sites" key-width="@kw" value="@Model.ConversionSupportNumberOfSites" asp-route-id="@Model.Id" asp-page="@Links.SchoolAndTrustInformationSection.NumberOfSites.Page" hidden-text="number of sites" />
<govuk-summary-list-row if="@Model.IsDao && string.IsNullOrEmpty(Model.ConversionSupportGrantChangeReason) != true" name="grant-funding-reason" label="Grant funding reason" key-width="@kw" value="@Model.ConversionSupportGrantChangeReason" asp-route-id="@Model.Id" asp-page="@Links.SchoolAndTrustInformationSection.GrantDetails.Page" hidden-text="grant funding reason" />
<govuk-summary-list-row if="@Model.IsDao && (Model.ConversionSupportGrantType == grantTypeFull || Model.ConversionSupportGrantType == grantTypeIntermediate)" name="grant-funding-environmental-improvement-grant" label="Is the school applying for an EIG (Environmental Improvement Grant)?" key-width="@kw" value="@Model.ConversionSupportGrantEnvironmentalImprovementGrant" asp-route-id="@Model.Id" asp-page="@Links.SchoolAndTrustInformationSection.GrantDetails.Page" hidden-text="grant environmental improvement" />
<govuk-summary-list-row if="@Model.IsDao|| @Model.IsPRU || @Model.IsSEN && string.IsNullOrEmpty(Model.ConversionSupportGrantChangeReason) != true" name="grant-funding-reason" label="Grant funding reason" key-width="@kw" value="@Model.ConversionSupportGrantChangeReason" asp-route-id="@Model.Id" asp-page="@Links.SchoolAndTrustInformationSection.GrantDetails.Page" hidden-text="grant funding reason" />
<govuk-summary-list-row if="@Model.IsDao || @Model.IsPRU || @Model.IsSEN && (Model.ConversionSupportGrantType == grantTypeFull || Model.ConversionSupportGrantType == grantTypeIntermediate)" name="grant-funding-environmental-improvement-grant" label="Is the school applying for an EIG (Environmental Improvement Grant)?" key-width="@kw" value="@Model.ConversionSupportGrantEnvironmentalImprovementGrant" asp-route-id="@Model.Id" asp-page="@Links.SchoolAndTrustInformationSection.GrantDetails.Page" hidden-text="grant environmental improvement" />

<govuk-summary-list-row name="advisory-board-date" label="Date of advisory board" key-width="@kw" value="@Model.HeadTeacherBoardDate" asp-page="@Links.SchoolAndTrustInformationSection.HeadTeacherBoardDate.Page" asp-route-id="@Model.Id" hidden-text="head teacher board date" />
<govuk-summary-list-row name="proposed-academy-opening-date" label="Proposed academy opening date" key-width="@kw" value="@Model.ProposedAcademyOpeningDate" asp-page="@Links.SchoolAndTrustInformationSection.ProposedAcademyOpeningDate.Page" asp-route-id="@Model.Id" hidden-text="proposed academy opening date" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<div class="govuk-summary-list__row">
<govuk-summary-list-row name="grant-funding-type" label="Grant type" key-width="@kw" value="@Model.Project.ConversionSupportGrantType" asp-route-id="@Model.Project.Id" asp-page="@Links.SchoolAndTrustInformationSection.GrantType.Page" hidden-text="grant funding type" />
<govuk-summary-list-row if="@Model.Project.IsPRU" name="grant-number-of-sites" label="Number of sites" key-width="@kw" value="@Model.Project.NumberOfSites" asp-route-id="@Model.Project.Id" asp-page="@Links.SchoolAndTrustInformationSection.NumberOfSites.Page" hidden-text="number of sites" />
<govuk-summary-list-row name="grant-funding-amount" label="Default grant amount" key-width="@kw" value="@UpdateAcademyConversionProjectPageModel.CalculateGrantAmount(Model.Project.ConversionSupportGrantType, Model.Project.SchoolPhase, Model.Project.NumberOfSites).ToMoneyString(true)" asp-route-id="Project.Id" hidden-text="grant funding amount" />
<govuk-summary-list-row name="grant-funding-amount" label="Default grant amount" key-width="@kw" value="@(Model.Project.IsPRU ? @UpdateAcademyConversionProjectPageModel.CalculatePRUGrantAmount(Model.Project.ConversionSupportGrantType, Model.Project.NumberOfSites).ToMoneyString(true) : @UpdateAcademyConversionProjectPageModel.CalculateGrantAmount(Model.Project.ConversionSupportGrantType, Model.Project.SchoolPhase).ToMoneyString(true))" asp-route-id="Project.Id" hidden-text="grant funding amount" />
</div>
</dl>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,9 @@ private void RePopDatePickerModelsAfterValidationFail()
Project.LocalAuthorityInformationTemplateSentDate = AcademyConversionProject.LocalAuthorityInformationTemplateSentDate;
Project.LocalAuthorityInformationTemplateReturnedDate = AcademyConversionProject.LocalAuthorityInformationTemplateReturnedDate;
}
public static decimal? CalculateGrantAmount(string type, string phase, string numberOfSites = "1")
public static decimal? CalculateGrantAmount(string type, string phase)
{
int defaultAmount = 25000;
int supplementAmount = CalculateGrantSupplement(numberOfSites);

defaultAmount += supplementAmount;

if (phase is null) return defaultAmount;
switch (phase.ToLower())
{
Expand All @@ -107,22 +103,36 @@ private void RePopDatePickerModelsAfterValidationFail()
SponsoredGrantType.FastTrack => 70000,
SponsoredGrantType.Full => 110000,
SponsoredGrantType.Intermediate => 90000,
_ => 25000
_ => defaultAmount
};
case "secondary":
return type switch
{
SponsoredGrantType.FastTrack => 80000,
SponsoredGrantType.Full => 150000,
SponsoredGrantType.Intermediate => 115000,
_ => 25000
_ => defaultAmount
};
}

// Else return default £25k
return defaultAmount;
}

public static decimal? CalculatePRUGrantAmount(string type, string numberOfSites = "1")
{
int defaultAmount = 25000;
int supplementAmount = CalculateGrantSupplement(numberOfSites);

return type switch
{
SponsoredGrantType.FastTrack => 70000 + supplementAmount,
SponsoredGrantType.Full => 110000 + supplementAmount,
SponsoredGrantType.Intermediate => 90000 + supplementAmount,
_ => defaultAmount + supplementAmount
};
}

protected UpdateAcademyConversionProject Build()
{
return new UpdateAcademyConversionProject
Expand Down Expand Up @@ -198,7 +208,7 @@ protected UpdateAcademyConversionProject Build()

private bool? ConversionSupportGrantAmountChanged(string academyRoute)
{
if (academyRoute == AcademyTypeAndRoutes.Sponsored)
if (academyRoute == AcademyTypeAndRoutes.Sponsored || academyRoute == AcademyTypeAndRoutes.Voluntary)
{
return AcademyConversionProject.ConversionSupportGrantAmountChanged;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,17 @@ private static List<TextElement[]> VoluntaryRouteInfo(AcademyConversionProject p
new TextElement { Value = project.AcademyOrderRequired }
},
};

if (project.SchoolType.ToLower().Contains("pupil referral unit"))
{
voluntaryRouteInfo.Add(new[]
{
new TextElement { Value = "Number of sites", Bold = true },
new TextElement { Value = project.ConversionSupportGrantNumberOfSites}
}
);
}

return voluntaryRouteInfo;

}
Expand Down Expand Up @@ -166,6 +177,17 @@ private static List<TextElement[]> SponsoredRouteInfo(AcademyConversionProject p
new TextElement { Value = project.DaoPackSentDate.ToDateString() }
},
};

if (project.SchoolType.ToLower().Contains("pupil referral unit"))
{
sponsoredRouteInfo.Add(new[]
{
new TextElement { Value = "Number of sites", Bold = true },
new TextElement { Value = project.ConversionSupportGrantNumberOfSites}
}
);
}

return sponsoredRouteInfo;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Dfe.PrepareConversions.DocumentGeneration.Elements;
using Dfe.PrepareConversions.DocumentGeneration.Interfaces;
using Dfe.PrepareConversions.Models;
using Dfe.PrepareConversions.Utils;
using System.Collections.Generic;

namespace Dfe.PrepareConversions.Services.DocumentGenerator
Expand Down Expand Up @@ -28,6 +29,18 @@ public static void AddSchoolOverview(IDocumentBuilder builder, HtbTemplate docum
},
new[] { new TextElement { Value = "Viability issues", Bold = true }, new TextElement { Value = document.ViabilityIssues } }});

if (document.SchoolType.ToLower().Contains("pupil referral unit"))
{
schoolOverviewTable.AddRange(new List<TextElement[]> {
new[] { new TextElement { Value = "Which groups of pupils attend the school", Bold = true }, new TextElement { Value = document.PupilsAttendingGroup } },
new[] { new TextElement { Value = "Number of places funded for", Bold = true }, new TextElement { Value = document.NumberOfPlacesFundedFor } },
new[] { new TextElement { Value = "Alternative provision", Bold = true }, new TextElement { Value = document.NumberOfAlternativeProvisionPlaces } },
new[] { new TextElement { Value = "SEN Unit", Bold = true }, new TextElement { Value = document.NumberOfSENUnitPlaces } },
new[] { new TextElement { Value = "Medical", Bold = true }, new TextElement { Value = document.NumberOfMedicalPlaces } },
new[] { new TextElement { Value = "Post-16", Bold = true }, new TextElement { Value = document.NumberOfPost16Places } },
});
}

// Specific SEN fields
if (document.SchoolType.ToLower().Contains("special"))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System;
using DocumentFormat.OpenXml.Drawing;
using AngleSharp.Text;
using System.Collections.Generic;

namespace Dfe.PrepareConversions.Utils
{
Expand All @@ -31,5 +32,27 @@ public static SetSchoolOverviewModel CreateUpdateSchoolOverview(ProjectViewModel
projectViewModel.PupilsAttendingGroupTeenageMums
);
}

public static string MapPupilsAttendingGroup(bool? pupilsAttendingGroupPermanentlyExcluded, bool? pupilsAttendingGroupMedicalAndHealthNeeds, bool? pupilsAttendingGroupTeenageMums)
{
var listOfAttendes = new List<string>();

if (pupilsAttendingGroupPermanentlyExcluded.HasValue && pupilsAttendingGroupPermanentlyExcluded.Value)
{
listOfAttendes.Add("Permanently Excluded");
}

if (pupilsAttendingGroupMedicalAndHealthNeeds.HasValue && pupilsAttendingGroupMedicalAndHealthNeeds.Value)
{
listOfAttendes.Add("Medical and Health Needs");
}

if (pupilsAttendingGroupTeenageMums.HasValue && pupilsAttendingGroupTeenageMums.Value)
{
listOfAttendes.Add("Teenage Mums");
}

return string.Join(", ", listOfAttendes);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Dfe.PrepareConversions.Data;
using Dfe.PrepareConversions.Data.Models;
using Dfe.PrepareConversions.Data.Services;
using Dfe.PrepareConversions.Extensions;
using Dfe.PrepareConversions.ViewModels;
using Microsoft.AspNetCore.Mvc;
using System;
Expand Down Expand Up @@ -44,7 +43,7 @@ public async Task<IViewComponentResult> InvokeAsync()
PreviousHeadTeacherBoardLink = project.PreviousHeadTeacherBoardLink,
SchoolName = project.SchoolName,
SchoolUrn = project.Urn.ToString(),
SchoolType = project.SchoolType.ToString(),
SchoolType = project?.SchoolType?.ToString(),
LocalAuthority = project.LocalAuthority,
TrustReferenceNumber = project.TrustReferenceNumber,
NameOfTrust = project.NameOfTrust,
Expand All @@ -54,11 +53,11 @@ public async Task<IViewComponentResult> InvokeAsync()
Form7Received = project.Form7Received,
Form7ReceivedDate = project.Form7ReceivedDate.ToDateString(),
WasForm7Received = project.Form7Received is not null && project.Form7Received.Equals("Yes"),
ConversionSupportGrantAmount = project.ConversionSupportGrantAmount?.ToMoneyString(true),
ConversionSupportGrantAmount = project?.ConversionSupportGrantAmount?.ToMoneyString(true),
ConversionSupportGrantChangeReason = project.ConversionSupportGrantChangeReason,
ConversionSupportGrantType = project.ConversionSupportGrantType,
ConversionSupportGrantEnvironmentalImprovementGrant = project.ConversionSupportGrantEnvironmentalImprovementGrant,
ConversionSupportNumberOfSites = project.ConversionSupportGrantNumberOfSites,
ConversionSupportNumberOfSites = project?.ConversionSupportGrantNumberOfSites,
ProposedAcademyOpeningDate = project.ProposedAcademyOpeningDate.ToDateString(true),
DaoPackSentDate = project.DaoPackSentDate.ToDateString()
};
Expand Down
Loading

0 comments on commit d6058d4

Please sign in to comment.