From 27bd67f1434c2664f24ebb2c4e359447b4fb5b95 Mon Sep 17 00:00:00 2001 From: plockwood Date: Tue, 2 Apr 2024 09:54:09 +0100 Subject: [PATCH 1/6] spelling fix --- .../TaskList/LegalRequirements/LegalGoverningBody.cshtml | 4 ++-- .../Pages/TaskList/LegalRequirements/LegalSummary.cshtml | 4 ++-- .../Pages/TaskList/PreviewProjectTemplate.cshtml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalGoverningBody.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalGoverningBody.cshtml index 1285a1697..a592ab578 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalGoverningBody.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalGoverningBody.cshtml @@ -2,7 +2,7 @@ @using Dfe.PrepareConversions.Data.Models.AcademyConversion @model Dfe.PrepareConversions.Pages.TaskList.LegalRequirements.LegalGoverningBodyModel @{ - ViewData["Title"] = "Management commitee resolution"; + ViewData["Title"] = "Management committee resolution"; } @section BeforeMain @@ -15,7 +15,7 @@
@Model.SchoolName -

Has the school provided a management commitee resolution?

+

Has the school provided a management committee resolution?

diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml index e99de8123..2932e8327 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml @@ -18,7 +18,7 @@
- Management commitee resolution + Management committee resolution
@if (Model.Requirements.GoverningBodyApproved.HasValue) @@ -32,7 +32,7 @@
- Change management commitee resolution + Change management committee resolution
diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/PreviewProjectTemplate.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/PreviewProjectTemplate.cshtml index 13a39c046..9076dd3ed 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/PreviewProjectTemplate.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/PreviewProjectTemplate.cshtml @@ -100,7 +100,7 @@
- + From 860a947e4b1452a5e8e6791522e66fca6d01350f Mon Sep 17 00:00:00 2001 From: plockwood Date: Tue, 2 Apr 2024 11:24:37 +0100 Subject: [PATCH 2/6] Maintenance mode filter --- .../Routing/MaintenancePageFilter.cs | 38 +++++++++++++++++++ .../Dfe.PrepareConversions/Startup.cs | 5 +++ .../Dfe.PrepareConversions/appsettings.json | 3 +- 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 Dfe.PrepareConversions/Dfe.PrepareConversions/Routing/MaintenancePageFilter.cs diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Routing/MaintenancePageFilter.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Routing/MaintenancePageFilter.cs new file mode 100644 index 000000000..e61ed1544 --- /dev/null +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Routing/MaintenancePageFilter.cs @@ -0,0 +1,38 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Primitives; +using System.Threading.Tasks; + +namespace Dfe.PrepareConversions.Routing +{ + public class MaintenancePageFilter : IAsyncPageFilter + { + private readonly IConfiguration _config; + + public MaintenancePageFilter(IConfiguration config) + { + _config = config; + } + + public Task OnPageHandlerSelectionAsync(PageHandlerSelectedContext context) + { + return Task.CompletedTask; + } + + public async Task OnPageHandlerExecutionAsync(PageHandlerExecutingContext context, + PageHandlerExecutionDelegate next) + { + bool maintenanceMode = bool.Parse(_config["MaintenanceMode"]); + + if (maintenanceMode && !context.ActionDescriptor.DisplayName.Contains("Maintenance")) + { + context.Result = new RedirectToPageResult("/public/maintenance"); + return; + } + + // Do post work. + await next.Invoke(); + } + } +} diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Startup.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Startup.cs index ebf67b88d..faf5b32cd 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Startup.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Startup.cs @@ -7,6 +7,7 @@ using Dfe.PrepareConversions.Data.Services.AzureAd; using Dfe.PrepareConversions.Data.Services.Interfaces; using Dfe.PrepareConversions.Models; +using Dfe.PrepareConversions.Routing; using Dfe.PrepareConversions.Security; using Dfe.PrepareConversions.Services; using Microsoft.AspNetCore.Authentication.Cookies; @@ -68,6 +69,10 @@ public void ConfigureServices(IServiceCollection services) .AddViewOptions(options => { options.HtmlHelperOptions.ClientValidationEnabled = false; + }).AddMvcOptions(options => + { + options.MaxModelValidationErrors = 50; + options.Filters.Add(new MaintenancePageFilter(Configuration)); }); services.AddControllersWithViews() diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/appsettings.json b/Dfe.PrepareConversions/Dfe.PrepareConversions/appsettings.json index 11811eba7..075fa92a1 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/appsettings.json +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/appsettings.json @@ -47,5 +47,6 @@ "FeatureManagement": { "UseAcademisationApplication": true, "ShowDirectedAcademyOrders": true - } + }, + "MaintenanceMode": false } From ca6974658f5623398e4a613385a74b89eb25a7e7 Mon Sep 17 00:00:00 2001 From: plockwood Date: Wed, 3 Apr 2024 11:31:22 +0100 Subject: [PATCH 3/6] dotnet 8 upgrade and packages upgrade to none breaking change latest --- .../Dfe.PrepareConversions.Data.Tests.csproj | 16 ++++++------- .../Dfe.PrepareConversions.Data.csproj | 14 +++++------ .../AcademyConversionProjectRepository.cs | 3 ++- .../Dfe.PrepareConversions.Data/libman.json | 5 ++++ ...onversions.DocumentGeneration.Tests.csproj | 10 ++++---- ...epareConversions.DocumentGeneration.csproj | 2 +- .../Dfe.PrepareConversions.Redirector.csproj | 4 ++-- .../Dfe.PrepareConversions.Tests.csproj | 24 +++++++++---------- .../Dfe.PrepareConversions.csproj | 18 +++++++------- ...emyConversionProjectItemsCacheDecorator.cs | 1 - Dockerfile | 5 ++-- 11 files changed, 54 insertions(+), 48 deletions(-) create mode 100644 Dfe.PrepareConversions/Dfe.PrepareConversions.Data/libman.json diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Data.Tests/Dfe.PrepareConversions.Data.Tests.csproj b/Dfe.PrepareConversions/Dfe.PrepareConversions.Data.Tests/Dfe.PrepareConversions.Data.Tests.csproj index 698fb4d83..9d37feea1 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Data.Tests/Dfe.PrepareConversions.Data.Tests.csproj +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Data.Tests/Dfe.PrepareConversions.Data.Tests.csproj @@ -1,21 +1,21 @@ - net6.0 + net8.0 false - - + + - - - + + + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Dfe.PrepareConversions.Data.csproj b/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Dfe.PrepareConversions.Data.csproj index daac5427d..47bdd8890 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Dfe.PrepareConversions.Data.csproj +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Dfe.PrepareConversions.Data.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 ..\.sonarlint\dfe-digital_a2b-internalcsharp.ruleset @@ -10,16 +10,16 @@ - + - - - - - + + + + + diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Services/AcademyConversionProjectRepository.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Services/AcademyConversionProjectRepository.cs index 6e8eec830..a81c46c71 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Services/AcademyConversionProjectRepository.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Services/AcademyConversionProjectRepository.cs @@ -4,12 +4,13 @@ using Dfe.PrepareConversions.Data.Models; using Dfe.PrepareConversions.Data.Models.NewProject; using Dfe.PrepareConversions.Data.Services.Interfaces; -using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Net.Http; using System.Net.Http.Json; using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; namespace Dfe.PrepareConversions.Data.Services; diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/libman.json b/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/libman.json new file mode 100644 index 000000000..ceee2710f --- /dev/null +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/libman.json @@ -0,0 +1,5 @@ +{ + "version": "1.0", + "defaultProvider": "cdnjs", + "libraries": [] +} \ No newline at end of file diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.DocumentGeneration.Tests/Dfe.PrepareConversions.DocumentGeneration.Tests.csproj b/Dfe.PrepareConversions/Dfe.PrepareConversions.DocumentGeneration.Tests/Dfe.PrepareConversions.DocumentGeneration.Tests.csproj index 35329471b..778e3da8f 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.DocumentGeneration.Tests/Dfe.PrepareConversions.DocumentGeneration.Tests.csproj +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.DocumentGeneration.Tests/Dfe.PrepareConversions.DocumentGeneration.Tests.csproj @@ -1,17 +1,17 @@ - net6.0 + net8.0 false - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.DocumentGeneration/Dfe.PrepareConversions.DocumentGeneration.csproj b/Dfe.PrepareConversions/Dfe.PrepareConversions.DocumentGeneration/Dfe.PrepareConversions.DocumentGeneration.csproj index 5c6b2a734..830e31419 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.DocumentGeneration/Dfe.PrepareConversions.DocumentGeneration.csproj +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.DocumentGeneration/Dfe.PrepareConversions.DocumentGeneration.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 ..\.sonarlint\dfe-digital_a2b-internalcsharp.ruleset diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Redirector/Dfe.PrepareConversions.Redirector.csproj b/Dfe.PrepareConversions/Dfe.PrepareConversions.Redirector/Dfe.PrepareConversions.Redirector.csproj index 78c2fba1d..825970e39 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Redirector/Dfe.PrepareConversions.Redirector.csproj +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Redirector/Dfe.PrepareConversions.Redirector.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 enable enable 87c23a87-e8b1-440f-b0a6-109d9521d781 @@ -10,7 +10,7 @@ - + diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Dfe.PrepareConversions.Tests.csproj b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Dfe.PrepareConversions.Tests.csproj index d695d4263..8c82e34f7 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Dfe.PrepareConversions.Tests.csproj +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Dfe.PrepareConversions.Tests.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 false @@ -13,19 +13,19 @@ - + - - + + - - - - - - - - + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Dfe.PrepareConversions.csproj b/Dfe.PrepareConversions/Dfe.PrepareConversions/Dfe.PrepareConversions.csproj index d92d5fd85..70fcc0c80 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Dfe.PrepareConversions.csproj +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Dfe.PrepareConversions.csproj @@ -1,6 +1,6 @@  - net6.0 + net8.0 eae6d8bd-2a58-4ed4-99e2-a82f32b0ce47 ..\.sonarlint\dfe-digital_a2b-internalcsharp.ruleset @@ -34,18 +34,18 @@ - + - - - - - - - + + + + + + + diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Services/AcademyConversionProjectItemsCacheDecorator.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Services/AcademyConversionProjectItemsCacheDecorator.cs index b1630f60c..c9feb79ed 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Services/AcademyConversionProjectItemsCacheDecorator.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Services/AcademyConversionProjectItemsCacheDecorator.cs @@ -2,7 +2,6 @@ using Dfe.PrepareConversions.Data.Models; using Dfe.PrepareConversions.Data.Models.NewProject; using Dfe.PrepareConversions.Data.Services; -using DocumentFormat.OpenXml.Office2010.Excel; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; diff --git a/Dockerfile b/Dockerfile index 7e659419b..69b7df405 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # Stage 1 - Restore and publish .NET layers -ARG ASPNET_IMAGE_TAG=6.0-bullseye-slim +ARG ASPNET_IMAGE_TAG=8.0-bookworm-slim ARG NODEJS_IMAGE_TAG=18.12-bullseye -FROM mcr.microsoft.com/dotnet/sdk:6.0 AS publish +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS publish WORKDIR /build COPY ./Dfe.PrepareConversions/ ./Dfe.PrepareConversions/ @@ -30,4 +30,5 @@ COPY --from=build /app /app WORKDIR /app COPY ./script/web-docker-entrypoint.sh ./docker-entrypoint.sh RUN chmod +x ./docker-entrypoint.sh +ENV ASPNETCORE_HTTP_PORTS=80 EXPOSE 80/tcp From de1e3b1a6a9febf39b4b243fc64cb930f845e0bd Mon Sep 17 00:00:00 2001 From: Ash Davies <3853061+DrizzlyOwl@users.noreply.github.com> Date: Thu, 4 Apr 2024 12:25:12 +0100 Subject: [PATCH 4/6] Disable CDN health probes (#1027) Front Door's health probes are designed to detect situations where an origin is unavailable or unhealthy. When a health probe detects a problem with an origin, Front Door can be configured to send traffic to another origin in the origin group. If you only have a single origin, Front Door always routes traffic to that origin even if its health probe reports an unhealthy status. The status of the health probe doesn't do anything to change Front Door's behavior. In this scenario, health probes don't provide a benefit and you should disable them to reduce the traffic on your origin. --- terraform/README.md | 1 + terraform/container-apps-hosting.tf | 1 + terraform/locals.tf | 1 + terraform/variables.tf | 6 ++++++ 4 files changed, 9 insertions(+) diff --git a/terraform/README.md b/terraform/README.md index 5f19ebada..23fd9b7c1 100644 --- a/terraform/README.md +++ b/terraform/README.md @@ -169,6 +169,7 @@ No resources. | [dns\_txt\_records](#input\_dns\_txt\_records) | DNS TXT records to add to the DNS Zone |
map(
object({
ttl : optional(number, 300),
records : list(string)
})
)
| n/a | yes | | [dns\_zone\_domain\_name](#input\_dns\_zone\_domain\_name) | DNS zone domain name. If created, records will automatically be created to point to the CDN. | `string` | n/a | yes | | [enable\_cdn\_frontdoor](#input\_enable\_cdn\_frontdoor) | Enable Azure CDN Front Door. This will use the Container Apps endpoint as the origin. | `bool` | n/a | yes | +| [enable\_cdn\_frontdoor\_health\_probe](#input\_enable\_cdn\_frontdoor\_health\_probe) | Enable CDN Front Door health probe | `bool` | `false` | no | | [enable\_container\_registry](#input\_enable\_container\_registry) | Set to true to create a container registry | `bool` | n/a | yes | | [enable\_dns\_zone](#input\_enable\_dns\_zone) | Conditionally create a DNS zone | `bool` | n/a | yes | | [enable\_event\_hub](#input\_enable\_event\_hub) | Send Azure Container App logs to an Event Hub sink | `bool` | `false` | no | diff --git a/terraform/container-apps-hosting.tf b/terraform/container-apps-hosting.tf index 9eccb4890..04700467d 100644 --- a/terraform/container-apps-hosting.tf +++ b/terraform/container-apps-hosting.tf @@ -38,6 +38,7 @@ module "azure_container_apps_hosting" { cdn_frontdoor_host_add_response_headers = local.cdn_frontdoor_host_add_response_headers cdn_frontdoor_custom_domains = local.cdn_frontdoor_custom_domains cdn_frontdoor_host_redirects = local.cdn_frontdoor_host_redirects + enable_cdn_frontdoor_health_probe = local.enable_cdn_frontdoor_health_probe container_apps_allow_ips_inbound = local.container_apps_allow_ips_inbound enable_monitoring = local.enable_monitoring diff --git a/terraform/locals.tf b/terraform/locals.tf index 5dc755355..200d5a989 100644 --- a/terraform/locals.tf +++ b/terraform/locals.tf @@ -30,6 +30,7 @@ locals { cdn_frontdoor_custom_domains = var.cdn_frontdoor_custom_domains cdn_frontdoor_host_redirects = var.cdn_frontdoor_host_redirects cdn_frontdoor_health_probe_protocol = var.cdn_frontdoor_health_probe_protocol + enable_cdn_frontdoor_health_probe = var.enable_cdn_frontdoor_health_probe key_vault_access_ipv4 = var.key_vault_access_ipv4 tfvars_filename = var.tfvars_filename enable_monitoring = var.enable_monitoring diff --git a/terraform/variables.tf b/terraform/variables.tf index 6a8a04c79..6087a5a6e 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -269,3 +269,9 @@ variable "statuscake_contact_group_email_addresses" { type = list(string) default = [] } + +variable "enable_cdn_frontdoor_health_probe" { + description = "Enable CDN Front Door health probe" + type = bool + default = false +} From 0a1e03562dcd6734baa56be403617ba7b7261d86 Mon Sep 17 00:00:00 2001 From: plockwood Date: Mon, 8 Apr 2024 15:01:00 +0100 Subject: [PATCH 5/6] Changes for adding project to existinf FAM --- .../NewProject/LinkFormAMatProject.cshtml.cs | 15 ++++++----- .../Pages/NewProject/Summary.cshtml | 27 ++++++++++++++++--- .../Pages/NewProject/Summary.cshtml.cs | 19 ++++++++----- 3 files changed, 43 insertions(+), 18 deletions(-) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/NewProject/LinkFormAMatProject.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/NewProject/LinkFormAMatProject.cshtml.cs index e18893555..df428e0b4 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/NewProject/LinkFormAMatProject.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/NewProject/LinkFormAMatProject.cshtml.cs @@ -61,11 +61,11 @@ public async Task OnGet(string urn, string isFormAMat, string has public async Task OnGetSearch(string searchQuery) { - string[] searchSplit = SplitOnBrackets(searchQuery); + string[] searchSplit = SplitOnBrackets(searchQuery); IEnumerable projects = (await _repository.SearchFormAMatProjects(searchQuery)).Body; - return new JsonResult(projects.Select(s => new { suggestion = HighlightSearchMatch($"{s.ProposedTrustName} ({DeduceReferenceNumber(s)})", searchSplit[0].Trim(), s), value = $"{DeduceReferenceNumber(s)}" })); + return new JsonResult(projects.Select(s => new { suggestion = HighlightSearchMatch($"{s.ProposedTrustName} ({s.ReferenceNumber}){IncludeA2BReferenceNumberIfAvailable(s)}", searchSplit[0].Trim(), s), value = $"{s.ProposedTrustName} ({s.ReferenceNumber}){IncludeA2BReferenceNumberIfAvailable(s)}" })); } public async Task OnPost(string ukprn, string urn, string redirect) @@ -77,14 +77,15 @@ public async Task OnPost(string ukprn, string urn, string redirec _errorService.AddError("Application Reference", "Please enter a application reference with more than three characters"); return Page(); } - - var applicationReference = SearchQuery; + string[] splitSearch = SplitOnBrackets(SearchQuery); + // Fam reference should always be second in array + var FamReference = splitSearch[1]; var nextPage = Links.NewProject.Summary.Page; redirect = string.IsNullOrEmpty(redirect) ? nextPage : redirect; - return RedirectToPage(redirect, new { ukprn, urn, HasSchoolApplied, IsFormAMat, IsProjectInPrepare, applicationReference }); + return RedirectToPage(redirect, new { ukprn, urn, HasSchoolApplied, IsFormAMat, IsProjectInPrepare, FamReference }); } private static string HighlightSearchMatch(string input, string toReplace, FormAMatProject project) @@ -105,8 +106,8 @@ private static string[] SplitOnBrackets(string input) return input.Split(new[] { '(', ')' }, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries); } - private static string DeduceReferenceNumber(FormAMatProject project) + private static string IncludeA2BReferenceNumberIfAvailable(FormAMatProject project) { - return !string.IsNullOrEmpty(project.ReferenceNumber) ? project.ReferenceNumber : project.ApplicationReference; + return !string.IsNullOrEmpty(project.ApplicationReference) ? $"({project.ApplicationReference})" : string.Empty; } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/NewProject/Summary.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/NewProject/Summary.cshtml index 3a9d6b811..75e3138eb 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/NewProject/Summary.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/NewProject/Summary.cshtml @@ -261,7 +261,7 @@
} - @if (Model.ApplicationReference != null) + @if (Model.IsFormAMat != null) {
@@ -283,9 +283,27 @@
- -
-
+ @if (Model.FamReference != null) + { +
+
+ FAM Reference +
+
+ @Model.FamReference +
+
+ + ChangeFAM reference + +
+
+ } + @if (Model.ApplicationReference != null) + { +
+
A2B Reference
@@ -298,6 +316,7 @@
+ }
diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/NewProject/Summary.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/NewProject/Summary.cshtml.cs index a569d5d7a..c670b5857 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/NewProject/Summary.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/NewProject/Summary.cshtml.cs @@ -35,9 +35,10 @@ public SummaryModel(IGetEstablishment getEstablishment, public string IsProjectInPrepare { get; set; } public string IsProjectAlreadyInPrepare { get; set; } public string ApplicationReference { get; set; } + public string FamReference { get; set; } - public async Task OnGetAsync(string urn, string ukprn, string hasSchoolApplied, string hasPreferredTrust, string proposedTrustName, string isFormAMat, string isProjectInPrepare, string applicationReference) + public async Task OnGetAsync(string urn, string ukprn, string hasSchoolApplied, string hasPreferredTrust, string proposedTrustName, string isFormAMat, string isProjectInPrepare, string famReference) { Establishment = await _getEstablishment.GetEstablishmentByUrn(urn); if (!string.IsNullOrEmpty(ukprn)) @@ -51,18 +52,22 @@ public async Task OnGetAsync(string urn, string ukprn, string has IsFormAMat = isFormAMat ?? "no"; IsProjectInPrepare = isProjectInPrepare ?? "no"; ProposedTrustName = proposedTrustName ?? null; - ApplicationReference = applicationReference ?? null; + FamReference = famReference ?? null; + ApplicationReference = null; - if (ApplicationReference != null) + if (FamReference != null) { - var results = await _academyConversionProjectRepository.SearchFormAMatProjects(ApplicationReference); - ProposedTrustName = results.Body.First().ProposedTrustName; + var results = await _academyConversionProjectRepository.SearchFormAMatProjects(FamReference); + var famProject = results.Body.First(); + + ProposedTrustName = famProject.ProposedTrustName; + ApplicationReference = string.IsNullOrEmpty(famProject.ApplicationReference) ? null : famProject.ApplicationReference; } return Page(); } - public async Task OnPostAsync(string urn, string ukprn, string hasSchoolApplied, string hasPreferredTrust, string proposedTrustName, string isFormAMat, string applicationReference) + public async Task OnPostAsync(string urn, string ukprn, string hasSchoolApplied, string hasPreferredTrust, string proposedTrustName, string isFormAMat, string famReference) { Academies.Contracts.V4.Establishments.EstablishmentDto establishment = await _getEstablishment.GetEstablishmentByUrn(urn); @@ -83,7 +88,7 @@ public async Task OnPostAsync(string urn, string ukprn, string ha if (_isFormAMAT && proposedTrustName == null) { var createdProject = await _academyConversionProjectRepository.CreateProject(CreateProjectMapper.MapToDto(establishment, trust, hasSchoolApplied, hasPreferredTrust, true)); - var formAMatProject = await _academyConversionProjectRepository.SearchFormAMatProjects(applicationReference); + var formAMatProject = await _academyConversionProjectRepository.SearchFormAMatProjects(famReference); int projectId = createdProject.Body.Id; var formAMatProjectID = formAMatProject.Body.First().Id; From dfc54855118f9b3c04827c0294c5700e92909da8 Mon Sep 17 00:00:00 2001 From: plockwood Date: Tue, 9 Apr 2024 12:48:58 +0100 Subject: [PATCH 6/6] Show FAM reference on form a mat project page --- .../Pages/FormAMat/FormAMatParentIndex.cshtml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/FormAMat/FormAMatParentIndex.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/FormAMat/FormAMatParentIndex.cshtml index 572091b8b..5e92a9f0a 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/FormAMat/FormAMatParentIndex.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/FormAMat/FormAMatParentIndex.cshtml @@ -12,7 +12,8 @@
- @if (Model.Project.ApplciationReference != null || Model.Project.ApplciationReference != string.Empty) + Form a MAT ref: @Model.Project.ReferenceNumber + @if (!string.IsNullOrEmpty(Model.Project.ApplciationReference)) { Application ref: @Model.Project.ApplciationReference }