From 4833172dfc094746e0a9307a116c3916e876304e Mon Sep 17 00:00:00 2001 From: plockwood Date: Fri, 22 Mar 2024 16:53:41 +0000 Subject: [PATCH 1/3] Route name changes --- .../Models/AcademyConversionProject.cs | 1 + .../Models/AcademyTypeAndRoutes.cs | 1 - .../Extensions/StringExtensionsTests.cs | 21 ++++++++++++------- .../Pages/BaseIntegrationTests.MockData.cs | 2 +- .../TaskList/PreviewProjectTemplateTests.cs | 2 -- .../ViewModels/ProjectListViewModelTests.cs | 10 --------- .../Extensions/StringExtensions.cs | 9 ++++---- .../Pages/FormAMat/FormAMatParentIndex.cshtml | 4 ++-- .../Pages/FormAMat/Index.cshtml.cs | 2 +- .../Pages/ProjectNotes/Index.cshtml.cs | 2 +- .../Shared/FormAMatProjectListRow.cshtml | 2 +- .../Shared/_OpenApplicationFormNewTab.cshtml | 2 +- .../Pages/Shared/_ProjectHeader.cshtml | 2 +- .../Pages/Shared/_ProjectListRows.cshtml | 4 ++-- .../Pages/Shared/_QuestionLayout.cshtml | 2 +- .../Pages/Shared/_SubMenu.cshtml | 2 +- .../Decision/RecordADecision.cshtml.cs | 2 +- .../Pages/TaskList/Index.cshtml.cs | 2 +- .../ConfirmProjectAndTrustRationale.cshtml | 2 +- .../Utils/ProjectListHelper.cs | 1 + .../ViewModels/ProjectTypeBase.cs | 6 +++--- .../ViewModels/ProjectViewModel.cs | 2 ++ 22 files changed, 39 insertions(+), 44 deletions(-) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Models/AcademyConversionProject.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Models/AcademyConversionProject.cs index b3c3fa2ea..dbea87fc3 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Models/AcademyConversionProject.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Models/AcademyConversionProject.cs @@ -8,6 +8,7 @@ public class AcademyConversionProject public int Id { get; set; } public int? Urn { get; set; } public int? FormAMatProjectId { get; set; } + public bool? IsFormAMat { get; set; } public DateTime CreatedOn { get; set; } public string SchoolName { get; set; } public string SchoolPhase { get; set; } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Models/AcademyTypeAndRoutes.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Models/AcademyTypeAndRoutes.cs index 1446aaf00..dc20493ea 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Models/AcademyTypeAndRoutes.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Models/AcademyTypeAndRoutes.cs @@ -9,7 +9,6 @@ namespace Dfe.PrepareConversions.Data.Models public static class AcademyTypeAndRoutes { public const string Voluntary = "Converter"; - public const string FormAMat = "Form a MAT"; public const string Sponsored = "Sponsored"; } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Extensions/StringExtensionsTests.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Extensions/StringExtensionsTests.cs index ae471fb88..91cbd3989 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Extensions/StringExtensionsTests.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Extensions/StringExtensionsTests.cs @@ -99,32 +99,37 @@ public void ToBool_Should_ThrowArgumentException_When_StringIsNotYesOrNo() [Fact] public void Should_be_able_to_convert_voluntary_conversion_route_to_the_correct_description() { - AcademyTypeAndRoutes.Voluntary.RouteDescription().Should().Be("Voluntary conversion"); + AcademyTypeAndRoutes.Voluntary.RouteDescription(false).Should().Be("Voluntary conversion"); } [Fact] public void Should_be_able_to_convert_sponsored_conversion_route_to_the_correct_description() { - AcademyTypeAndRoutes.Sponsored.RouteDescription().Should().Be("Sponsored conversion"); + AcademyTypeAndRoutes.Sponsored.RouteDescription(false).Should().Be("Sponsored conversion"); } [Fact] - public void Should_convert_form_a_mat_route_to_the_correct_description() + public void Should_convert_voluntary_form_a_mat_route_to_the_correct_description() { - AcademyTypeAndRoutes.FormAMat.RouteDescription().Should().Be("Form a MAT"); + AcademyTypeAndRoutes.Voluntary.RouteDescription(true).Should().Be("Form a MAT Voluntary conversion"); + } + + [Fact] + public void Should_convert_sponsored_form_a_mat_route_to_the_correct_description() + { + AcademyTypeAndRoutes.Voluntary.RouteDescription(true).Should().Be("Form a MAT Sponsored conversion"); } [Fact] public void Should_pass_through_unrecognised_routes_unchanged() { - "This is unknown".RouteDescription().Should().Be("This is unknown"); + "This is unknown".RouteDescription(null).Should().Be("This is unknown"); } [Fact] public void Should_ignore_capitalisation_and_spaces_in_routes() { - "CoN vEr TeR".RouteDescription().Should().Be("Voluntary conversion"); - "FORMaMAT".RouteDescription().Should().Be("Form a MAT"); + "CoN vEr TeR".RouteDescription(null).Should().Be("Voluntary conversion"); } [Theory] @@ -133,6 +138,6 @@ public void Should_ignore_capitalisation_and_spaces_in_routes() [InlineData("")] public void RouteDescription_Should_Return_EmptyString_When_Passed_NullOrWhitespace(string input) { - input.RouteDescription().Should().Be(string.Empty); + input.RouteDescription(null).Should().Be(string.Empty); } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/BaseIntegrationTests.MockData.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/BaseIntegrationTests.MockData.cs index 6f515bd7c..9093db381 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/BaseIntegrationTests.MockData.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/BaseIntegrationTests.MockData.cs @@ -18,7 +18,7 @@ namespace Dfe.PrepareConversions.Tests.Pages; public abstract partial class BaseIntegrationTests { - private readonly string[] _routes = { AcademyTypeAndRoutes.Voluntary, AcademyTypeAndRoutes.Sponsored, AcademyTypeAndRoutes.FormAMat }; + private readonly string[] _routes = { AcademyTypeAndRoutes.Voluntary, AcademyTypeAndRoutes.Sponsored }; protected IEnumerable AddGetProjects(Action postSetup = null, int? recordCount = null, diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/PreviewProjectTemplateTests.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/PreviewProjectTemplateTests.cs index ca3e9f88b..ef48a3e65 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/PreviewProjectTemplateTests.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/PreviewProjectTemplateTests.cs @@ -43,7 +43,6 @@ static void PostProjectSetup(AcademyConversionProject project) [Theory] [InlineData(AcademyTypeAndRoutes.Voluntary)] - [InlineData(AcademyTypeAndRoutes.FormAMat)] public async Task Given_Not_SponsoredConversion_When_Previewed_Then_LegalRequirements_Are_Shown(string routeToConversion) { void PostProjectSetup(AcademyConversionProject project) @@ -58,7 +57,6 @@ void PostProjectSetup(AcademyConversionProject project) [Theory] [InlineData(AcademyTypeAndRoutes.Voluntary)] - [InlineData(AcademyTypeAndRoutes.FormAMat)] public async Task Given_Not_SponsoredConversion_When_Previewed_Then_RationaleForProject_Is_Shown(string routeToConversion) { void PostProjectSetup(AcademyConversionProject project) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/ViewModels/ProjectListViewModelTests.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/ViewModels/ProjectListViewModelTests.cs index be280e87e..390322ad8 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/ViewModels/ProjectListViewModelTests.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/ViewModels/ProjectListViewModelTests.cs @@ -39,16 +39,6 @@ public void Should_be_considered_sponsored_if_the_route_is_sponsored() .IsSponsored.Should().BeFalse(); } - [Fact] - public void Should_be_considered_a_form_a_mat_project_if_the_route_is_form_a_met() - { - new ProjectListViewModel { TypeAndRoute = AcademyTypeAndRoutes.FormAMat } - .IsFormAMat.Should().BeTrue(); - - new ProjectListViewModel { TypeAndRoute = "Anything else" } - .IsFormAMat.Should().BeFalse(); - } - [Fact] public void Should_be_considered_a_voluntary_conversion_if_the_project_is_neither_sponsored_nor_form_a_mat() { diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Extensions/StringExtensions.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Extensions/StringExtensions.cs index 20338dabd..3ddff9463 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Extensions/StringExtensions.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Extensions/StringExtensions.cs @@ -4,22 +4,21 @@ public static class StringExtensions { - public static string RouteDescription(this string @string) + public static string RouteDescription(this string @string, bool? isFormAMat) { const string converter = nameof(converter); const string sponsored = nameof(sponsored); - const string formamat = nameof(formamat); if (string.IsNullOrWhiteSpace(@string)) { return string.Empty; } + var stringPrefix = isFormAMat.HasValue && isFormAMat.Value ? "Form a MAT " : string.Empty; return @string.SquishToLower() switch { - sponsored => "Sponsored conversion", - converter => "Voluntary conversion", - formamat => "Form a MAT", + sponsored => stringPrefix + "Sponsored conversion", + converter => stringPrefix + "Voluntary conversion", _ => @string, }; } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/FormAMat/FormAMatParentIndex.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/FormAMat/FormAMatParentIndex.cshtml index e70af2f6d..07a294ec1 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/FormAMat/FormAMatParentIndex.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/FormAMat/FormAMatParentIndex.cshtml @@ -76,7 +76,7 @@ { var projectRow = project.Row(index); - var isFormAMat = project.IsFormAMat; + var isFormAMat = project.IsFormAMat.HasValue && project.IsFormAMat.Value; var matTypeClass = isFormAMat ? "form-a-mat" : "join-a-mat"; var link = @Links.TaskList.Index.Page; @@ -115,7 +115,7 @@
Route: Unconfirmed - @projectRow.Item.TypeAndRoute.RouteDescription() + @projectRow.Item.TypeAndRoute.RouteDescription(project.IsFormAMat)
@if (!isFormAMat) { diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/FormAMat/Index.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/FormAMat/Index.cshtml.cs index 92b1ae630..a002438d0 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/FormAMat/Index.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/FormAMat/Index.cshtml.cs @@ -76,7 +76,7 @@ public override async Task OnGetAsync(int id) ReturnPage = @Links.ProjectList.Index.Page; var returnToFormAMatMenu = TempData["returnToFormAMatMenu"] as bool?; - if (Project.IsFormAMat && returnToFormAMatMenu.HasValue && returnToFormAMatMenu.Value) + if (Project.IsFormAMat.HasValue && Project.IsFormAMat.Value && returnToFormAMatMenu.HasValue && returnToFormAMatMenu.Value) { ReturnId = Project.FormAMatProjectId.ToString(); ReturnPage = @Links.FormAMat.OtherSchoolsInMat.Page; diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/ProjectNotes/Index.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/ProjectNotes/Index.cshtml.cs index 529c24d2a..935898cc6 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/ProjectNotes/Index.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/ProjectNotes/Index.cshtml.cs @@ -32,7 +32,7 @@ public override async Task OnGetAsync(int id) ReturnPage = @Links.ProjectList.Index.Page; var returnToFormAMatMenu = TempData["returnToFormAMatMenu"] as bool?; - if (Project.IsFormAMat && returnToFormAMatMenu.HasValue && returnToFormAMatMenu.Value) + if (Project.IsFormAMat.HasValue && Project.IsFormAMat.Value && returnToFormAMatMenu.HasValue && returnToFormAMatMenu.Value) { ReturnId = Project.FormAMatProjectId.ToString(); ReturnPage = @Links.FormAMat.OtherSchoolsInMat.Page; diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/FormAMatProjectListRow.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/FormAMatProjectListRow.cshtml index 93fc7a65b..6dc85ba7d 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/FormAMatProjectListRow.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/FormAMatProjectListRow.cshtml @@ -11,7 +11,7 @@ URN: @Model.Item.SchoolURN

-

Route: @Model.Item.TypeAndRoute.RouteDescription()
+
Route: @Model.Item.TypeAndRoute.RouteDescription(true)
Application to join a trust: @Model.Item.NameOfTrust
@if (@Model.Item.LocalAuthority.IsEmpty() is false) { diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_OpenApplicationFormNewTab.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_OpenApplicationFormNewTab.cshtml index ada50d805..3367028a8 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_OpenApplicationFormNewTab.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_OpenApplicationFormNewTab.cshtml @@ -1,7 +1,7 @@ @using Dfe.PrepareConversions.Data.Models @if (ViewData["AcademyTypeAndRoute"] is not null) { - @if (ViewData["AcademyTypeAndRoute"].Equals(AcademyTypeAndRoutes.Voluntary) || ViewData["AcademyTypeAndRoute"].Equals(AcademyTypeAndRoutes.FormAMat)) + @if (ViewData["AcademyTypeAndRoute"].Equals(AcademyTypeAndRoutes.Voluntary)) {

This information comes from TRAMS and the diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectHeader.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectHeader.cshtml index 352ee0990..1a8b3d39b 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectHeader.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectHeader.cshtml @@ -6,7 +6,7 @@ @Model.SchoolName

- Route: @Model.AcademyTypeAndRoute.RouteDescription() + Route: @Model.AcademyTypeAndRoute.RouteDescription(@Model.IsFormAMat.HasValue && @Model.IsFormAMat.Value)

Project owner: diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectListRows.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectListRows.cshtml index c44c689d6..ba693aadc 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectListRows.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectListRows.cshtml @@ -9,7 +9,7 @@ { var projectRow = project.Row(index); - var isFormAMat = project.IsFormAMat; + var isFormAMat = project.IsFormAMat.HasValue && project.IsFormAMat.Value; var matTypeClass = isFormAMat ? "form-a-mat" : "join-a-mat"; var link = @Links.TaskList.Index.Page; @@ -48,7 +48,7 @@

Route: Unconfirmed - @projectRow.Item.TypeAndRoute.RouteDescription() + @projectRow.Item.TypeAndRoute.RouteDescription(project.IsFormAMat)
@if (!isFormAMat) { diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_QuestionLayout.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_QuestionLayout.cshtml index 9647d2250..7b6ae63f2 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_QuestionLayout.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_QuestionLayout.cshtml @@ -31,7 +31,7 @@ { } - else if (ViewData["AcademyTypeAndRoute"].Equals(AcademyTypeAndRoutes.Voluntary) || ViewData["AcademyTypeAndRoute"].Equals(AcademyTypeAndRoutes.FormAMat)) + else if (ViewData["AcademyTypeAndRoute"].Equals(AcademyTypeAndRoutes.Voluntary)) { } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_SubMenu.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_SubMenu.cshtml index 816d66bc3..535ee600c 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_SubMenu.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_SubMenu.cshtml @@ -21,7 +21,7 @@ School application form -
  • +
  • diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml.cs index 8f14c4e2b..1412caf3d 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml.cs @@ -20,7 +20,7 @@ public async override Task OnGetAsync(int id) ReturnPage = @Links.ProjectList.Index.Page; var returnToFormAMatMenu = TempData["returnToFormAMatMenu"] as bool?; - if (Project.IsFormAMat && returnToFormAMatMenu.HasValue && returnToFormAMatMenu.Value) + if (Project.IsFormAMat.HasValue && Project.IsFormAMat.Value && returnToFormAMatMenu.HasValue && returnToFormAMatMenu.Value) { ReturnId = Project.FormAMatProjectId.ToString(); ReturnPage = @Links.FormAMat.OtherSchoolsInMat.Page; diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Index.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Index.cshtml.cs index 985b10133..e79d3b5f4 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Index.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Index.cshtml.cs @@ -59,7 +59,7 @@ public override async Task OnGetAsync(int id) var returnToFormAMatMenu = TempData["returnToFormAMatMenu"] as bool?; - if (Project.IsFormAMat && returnToFormAMatMenu.HasValue && returnToFormAMatMenu.Value) { + if (Project.IsFormAMat.HasValue && Project.IsFormAMat.Value && returnToFormAMatMenu.HasValue && returnToFormAMatMenu.Value) { ReturnId = Project.FormAMatProjectId.ToString(); ReturnPage = @Links.FormAMat.OtherSchoolsInMat.Page; TempData["returnToFormAMatMenu"] = true; diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Rationale/ConfirmProjectAndTrustRationale.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Rationale/ConfirmProjectAndTrustRationale.cshtml index 4bba17c53..d8ea75f01 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Rationale/ConfirmProjectAndTrustRationale.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Rationale/ConfirmProjectAndTrustRationale.cshtml @@ -27,7 +27,7 @@ Confirm project and trust rationale
    - @if (ViewData["AcademyTypeAndRoute"].Equals(AcademyTypeAndRoutes.Voluntary) || ViewData["AcademyTypeAndRoute"].Equals(AcademyTypeAndRoutes.FormAMat)) + @if (ViewData["AcademyTypeAndRoute"].Equals(AcademyTypeAndRoutes.Voluntary)) {

    This information comes from the diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Utils/ProjectListHelper.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Utils/ProjectListHelper.cs index 9706d2ef2..1863f9b9d 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Utils/ProjectListHelper.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Utils/ProjectListHelper.cs @@ -15,6 +15,7 @@ public static ProjectListViewModel Build(AcademyConversionProject academyConvers return new ProjectListViewModel { Id = academyConversionProject.Id.ToString(), + IsFormAMat = academyConversionProject.IsFormAMat, SchoolURN = academyConversionProject.Urn.HasValue ? academyConversionProject.Urn.ToString() : "", SchoolName = academyConversionProject.SchoolName, LocalAuthority = academyConversionProject.LocalAuthority, diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/ProjectTypeBase.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/ProjectTypeBase.cs index 8475612fb..40a2151d5 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/ProjectTypeBase.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/ProjectTypeBase.cs @@ -6,6 +6,9 @@ namespace Dfe.PrepareConversions.ViewModels; public abstract class ProjectTypeBase { protected abstract string TypeAndRouteValue { get; } + + public bool? IsFormAMat { get; init; } + public virtual bool IsExternalSchoolApplication { get; } = false; @@ -14,7 +17,4 @@ public abstract class ProjectTypeBase public bool IsVoluntary => string.IsNullOrWhiteSpace(TypeAndRouteValue) is false && TypeAndRouteValue.Equals(AcademyTypeAndRoutes.Voluntary, StringComparison.InvariantCultureIgnoreCase); - - public bool IsFormAMat => string.IsNullOrWhiteSpace(TypeAndRouteValue) is false && - TypeAndRouteValue.Equals(AcademyTypeAndRoutes.FormAMat, StringComparison.InvariantCultureIgnoreCase); } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/ProjectViewModel.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/ProjectViewModel.cs index 1d66478df..5bcd3ad31 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/ProjectViewModel.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/ProjectViewModel.cs @@ -12,6 +12,7 @@ public ProjectViewModel(AcademyConversionProject project) { Id = project.Id.ToString(); FormAMatProjectId = project.FormAMatProjectId; + IsFormAMat = project.IsFormAMat; ProjectStatus = ProjectListHelper.MapProjectStatus(project.ProjectStatus).Value; ProjectStatusColour = ProjectListHelper.MapProjectStatus(project.ProjectStatus).Colour; ApplicationReferenceNumber = project.ApplicationReferenceNumber; @@ -129,6 +130,7 @@ public ProjectViewModel(AcademyConversionProject project) public string Id { get; } public int? FormAMatProjectId { get; } + public bool? IsFormAMat { get; } public string ProjectStatus { get; } public string ProjectStatusColour { get; } public string ApplicationReferenceNumber { get; set; } From 25f4e42c10914e4674c812caaf8ed639c2b70e16 Mon Sep 17 00:00:00 2001 From: plockwood Date: Fri, 22 Mar 2024 16:58:51 +0000 Subject: [PATCH 2/3] test fix --- .../Extensions/StringExtensionsTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Extensions/StringExtensionsTests.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Extensions/StringExtensionsTests.cs index 91cbd3989..ad6ed47a5 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Extensions/StringExtensionsTests.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Extensions/StringExtensionsTests.cs @@ -117,7 +117,7 @@ public void Should_convert_voluntary_form_a_mat_route_to_the_correct_description [Fact] public void Should_convert_sponsored_form_a_mat_route_to_the_correct_description() { - AcademyTypeAndRoutes.Voluntary.RouteDescription(true).Should().Be("Form a MAT Sponsored conversion"); + AcademyTypeAndRoutes.Sponsored.RouteDescription(true).Should().Be("Form a MAT Sponsored conversion"); } [Fact] From 7c3d727eb83a74cda23267dc59e741e6c1fdb48b Mon Sep 17 00:00:00 2001 From: plockwood Date: Wed, 27 Mar 2024 14:30:42 +0000 Subject: [PATCH 3/3] refactor is form a mat flag on page model --- .../Pages/FormAMat/FormAMatParentIndex.cshtml | 2 +- .../Dfe.PrepareConversions/Pages/FormAMat/Index.cshtml.cs | 2 +- .../Dfe.PrepareConversions/Pages/ProjectNotes/Index.cshtml.cs | 2 +- .../Dfe.PrepareConversions/Pages/Shared/_ProjectHeader.cshtml | 2 +- .../Pages/Shared/_ProjectListRows.cshtml | 2 +- .../Dfe.PrepareConversions/Pages/Shared/_SubMenu.cshtml | 2 +- .../Pages/TaskList/Decision/RecordADecision.cshtml.cs | 2 +- .../Dfe.PrepareConversions/Pages/TaskList/Index.cshtml.cs | 2 +- .../Dfe.PrepareConversions/Utils/ProjectListHelper.cs | 2 +- .../Dfe.PrepareConversions/ViewModels/ProjectTypeBase.cs | 2 +- .../Dfe.PrepareConversions/ViewModels/ProjectViewModel.cs | 4 ++-- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/FormAMat/FormAMatParentIndex.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/FormAMat/FormAMatParentIndex.cshtml index 9538088c6..572091b8b 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/FormAMat/FormAMatParentIndex.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/FormAMat/FormAMatParentIndex.cshtml @@ -79,7 +79,7 @@ { var projectRow = project.Row(index); - var isFormAMat = project.IsFormAMat.HasValue && project.IsFormAMat.Value; + var isFormAMat = project.IsFormAMat; var matTypeClass = isFormAMat ? "form-a-mat" : "join-a-mat"; var link = @Links.TaskList.Index.Page; diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/FormAMat/Index.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/FormAMat/Index.cshtml.cs index a002438d0..92b1ae630 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/FormAMat/Index.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/FormAMat/Index.cshtml.cs @@ -76,7 +76,7 @@ public override async Task OnGetAsync(int id) ReturnPage = @Links.ProjectList.Index.Page; var returnToFormAMatMenu = TempData["returnToFormAMatMenu"] as bool?; - if (Project.IsFormAMat.HasValue && Project.IsFormAMat.Value && returnToFormAMatMenu.HasValue && returnToFormAMatMenu.Value) + if (Project.IsFormAMat && returnToFormAMatMenu.HasValue && returnToFormAMatMenu.Value) { ReturnId = Project.FormAMatProjectId.ToString(); ReturnPage = @Links.FormAMat.OtherSchoolsInMat.Page; diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/ProjectNotes/Index.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/ProjectNotes/Index.cshtml.cs index 935898cc6..529c24d2a 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/ProjectNotes/Index.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/ProjectNotes/Index.cshtml.cs @@ -32,7 +32,7 @@ public override async Task OnGetAsync(int id) ReturnPage = @Links.ProjectList.Index.Page; var returnToFormAMatMenu = TempData["returnToFormAMatMenu"] as bool?; - if (Project.IsFormAMat.HasValue && Project.IsFormAMat.Value && returnToFormAMatMenu.HasValue && returnToFormAMatMenu.Value) + if (Project.IsFormAMat && returnToFormAMatMenu.HasValue && returnToFormAMatMenu.Value) { ReturnId = Project.FormAMatProjectId.ToString(); ReturnPage = @Links.FormAMat.OtherSchoolsInMat.Page; diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectHeader.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectHeader.cshtml index 1a8b3d39b..8bf74b8e6 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectHeader.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectHeader.cshtml @@ -6,7 +6,7 @@ @Model.SchoolName

    - Route: @Model.AcademyTypeAndRoute.RouteDescription(@Model.IsFormAMat.HasValue && @Model.IsFormAMat.Value) + Route: @Model.AcademyTypeAndRoute.RouteDescription(@Model.IsFormAMat)

    Project owner: diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectListRows.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectListRows.cshtml index ba693aadc..02baaeee8 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectListRows.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectListRows.cshtml @@ -9,7 +9,7 @@ { var projectRow = project.Row(index); - var isFormAMat = project.IsFormAMat.HasValue && project.IsFormAMat.Value; + var isFormAMat = project.IsFormAMat; var matTypeClass = isFormAMat ? "form-a-mat" : "join-a-mat"; var link = @Links.TaskList.Index.Page; diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_SubMenu.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_SubMenu.cshtml index 535ee600c..8d3abba76 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_SubMenu.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_SubMenu.cshtml @@ -21,7 +21,7 @@ School application form

  • -
  • +
  • diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml.cs index 1412caf3d..8f14c4e2b 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml.cs @@ -20,7 +20,7 @@ public async override Task OnGetAsync(int id) ReturnPage = @Links.ProjectList.Index.Page; var returnToFormAMatMenu = TempData["returnToFormAMatMenu"] as bool?; - if (Project.IsFormAMat.HasValue && Project.IsFormAMat.Value && returnToFormAMatMenu.HasValue && returnToFormAMatMenu.Value) + if (Project.IsFormAMat && returnToFormAMatMenu.HasValue && returnToFormAMatMenu.Value) { ReturnId = Project.FormAMatProjectId.ToString(); ReturnPage = @Links.FormAMat.OtherSchoolsInMat.Page; diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Index.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Index.cshtml.cs index e79d3b5f4..985b10133 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Index.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Index.cshtml.cs @@ -59,7 +59,7 @@ public override async Task OnGetAsync(int id) var returnToFormAMatMenu = TempData["returnToFormAMatMenu"] as bool?; - if (Project.IsFormAMat.HasValue && Project.IsFormAMat.Value && returnToFormAMatMenu.HasValue && returnToFormAMatMenu.Value) { + if (Project.IsFormAMat && returnToFormAMatMenu.HasValue && returnToFormAMatMenu.Value) { ReturnId = Project.FormAMatProjectId.ToString(); ReturnPage = @Links.FormAMat.OtherSchoolsInMat.Page; TempData["returnToFormAMatMenu"] = true; diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Utils/ProjectListHelper.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Utils/ProjectListHelper.cs index 7190945c1..02f8c0add 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Utils/ProjectListHelper.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Utils/ProjectListHelper.cs @@ -15,7 +15,7 @@ public static ProjectListViewModel Build(AcademyConversionProject academyConvers return new ProjectListViewModel { Id = academyConversionProject.Id.ToString(), - IsFormAMat = academyConversionProject.IsFormAMat, + IsFormAMat = academyConversionProject.IsFormAMat.HasValue && academyConversionProject.IsFormAMat.Value, SchoolURN = academyConversionProject.Urn.HasValue ? academyConversionProject.Urn.ToString() : "", SchoolName = academyConversionProject.SchoolName, LocalAuthority = academyConversionProject.LocalAuthority, diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/ProjectTypeBase.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/ProjectTypeBase.cs index 40a2151d5..82a0e6f38 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/ProjectTypeBase.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/ProjectTypeBase.cs @@ -7,7 +7,7 @@ public abstract class ProjectTypeBase { protected abstract string TypeAndRouteValue { get; } - public bool? IsFormAMat { get; init; } + public bool IsFormAMat { get; init; } public virtual bool IsExternalSchoolApplication { get; } = false; diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/ProjectViewModel.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/ProjectViewModel.cs index 5bcd3ad31..cacccd5f1 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/ProjectViewModel.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/ProjectViewModel.cs @@ -12,7 +12,7 @@ public ProjectViewModel(AcademyConversionProject project) { Id = project.Id.ToString(); FormAMatProjectId = project.FormAMatProjectId; - IsFormAMat = project.IsFormAMat; + IsFormAMat = project.IsFormAMat.HasValue && project.IsFormAMat.Value; ProjectStatus = ProjectListHelper.MapProjectStatus(project.ProjectStatus).Value; ProjectStatusColour = ProjectListHelper.MapProjectStatus(project.ProjectStatus).Colour; ApplicationReferenceNumber = project.ApplicationReferenceNumber; @@ -130,7 +130,7 @@ public ProjectViewModel(AcademyConversionProject project) public string Id { get; } public int? FormAMatProjectId { get; } - public bool? IsFormAMat { get; } + public bool IsFormAMat { get; } public string ProjectStatus { get; } public string ProjectStatusColour { get; } public string ApplicationReferenceNumber { get; set; }