diff --git a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API.Contracts/Project/ProjectStatus.cs b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API.Contracts/Project/ProjectStatus.cs index 0a4fa891c..3684862fb 100644 --- a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API.Contracts/Project/ProjectStatus.cs +++ b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API.Contracts/Project/ProjectStatus.cs @@ -17,8 +17,12 @@ public enum ProjectStatus Cancelled, [Description("Withdrawn in pre-opening")] + WithdrawnInPreOpening, + + //Possible legacy value + [Description("Withdrawn during pre-opening")] WithdrawnDuringPreOpening, - + [Description("Application competition stage")] ApplicationCompetitionStage, diff --git a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API.Tests/Project/ProjectMapperTests.cs b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API.Tests/Project/ProjectMapperTests.cs index 4e221ded1..b5c53cc95 100644 --- a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API.Tests/Project/ProjectMapperTests.cs +++ b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API.Tests/Project/ProjectMapperTests.cs @@ -51,8 +51,8 @@ public void ToTrustType_ReturnsExpectedEnum(string input, TrustType expectedResu [InlineData("Cancelled",ProjectStatus.Cancelled)] [InlineData("Cancelled during pre-opening",ProjectStatus.Cancelled)] [InlineData("Closed",ProjectStatus.Closed)] - [InlineData("Withdrawn during pre-opening",ProjectStatus.WithdrawnDuringPreOpening)] - [InlineData("Withdrawn in pre-opening",ProjectStatus.WithdrawnDuringPreOpening)] + [InlineData("Withdrawn during pre-opening",ProjectStatus.WithdrawnInPreOpening)] + [InlineData("Withdrawn in pre-opening",ProjectStatus.WithdrawnInPreOpening)] [InlineData("Application Competition stage",ProjectStatus.ApplicationCompetitionStage)] [InlineData("Application stage",ProjectStatus.ApplicationStage)] [InlineData("Open free school - Not included in figures", ProjectStatus.OpenNotIncludedInFigures)] @@ -72,7 +72,7 @@ public void ToProjectStatusType_ReturnsExpectedEnum(string input, ProjectStatus //[InlineData("AnyNotRecognised", ProjectStatus.Preopening)] [InlineData(ProjectStatus.Cancelled, "Cancelled during pre-opening")] [InlineData(ProjectStatus.Closed, "Closed")] - [InlineData(ProjectStatus.WithdrawnDuringPreOpening, "Withdrawn in pre-opening")] + [InlineData(ProjectStatus.WithdrawnInPreOpening, "Withdrawn in pre-opening")] [InlineData(ProjectStatus.ApplicationCompetitionStage, "Application Competition stage")] [InlineData(ProjectStatus.ApplicationStage, "Application stage")] [InlineData(ProjectStatus.OpenNotIncludedInFigures, "Open free school - Not included in figures")] diff --git a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API/UseCases/BulkEdit/Validations/ProjectStatusValidationCommand.cs b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API/UseCases/BulkEdit/Validations/ProjectStatusValidationCommand.cs index e0967315b..19af77ef5 100644 --- a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API/UseCases/BulkEdit/Validations/ProjectStatusValidationCommand.cs +++ b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API/UseCases/BulkEdit/Validations/ProjectStatusValidationCommand.cs @@ -15,7 +15,7 @@ public ValidationResult Execute(ValidationCommandParameters paramet ProjectStatus.Cancelled, ProjectStatus.Open, ProjectStatus.Closed, - ProjectStatus.WithdrawnDuringPreOpening + ProjectStatus.WithdrawnInPreOpening ]; ProjectStatus? status = null; diff --git a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API/UseCases/Dashboard/GetDashboardService.cs b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API/UseCases/Dashboard/GetDashboardService.cs index 6f66ba0e5..980dd6fe2 100644 --- a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API/UseCases/Dashboard/GetDashboardService.cs +++ b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API/UseCases/Dashboard/GetDashboardService.cs @@ -1,4 +1,5 @@ using Dfe.ManageFreeSchoolProjects.API.Contracts.Dashboard; +using Dfe.ManageFreeSchoolProjects.API.Contracts.Project; using Dfe.ManageFreeSchoolProjects.API.Extensions; using Dfe.ManageFreeSchoolProjects.API.UseCases.Project; using Dfe.ManageFreeSchoolProjects.Data; @@ -79,9 +80,15 @@ private static IQueryable ApplyFilters(IQueryable query, GetDashboardP if (parameters.ProjectManagedBy.Count != 0) query = query.Where(kpi => parameters.ProjectManagedBy.Any(projectManagedBy => kpi.KeyContactsFsgLeadContact == projectManagedBy)); - - if (parameters.ProjectStatus.Count != 0) - query = query.Where(kpi => parameters.ProjectStatus.Any(projectStatus => kpi.ProjectStatusProjectStatus == projectStatus)); + + var projectStatuses = parameters.ProjectStatus; + if (projectStatuses.Count != 0) + { + if (projectStatuses.Any(x => x == ProjectStatus.WithdrawnInPreOpening.ToDescription())) + projectStatuses.Add(ProjectStatus.WithdrawnDuringPreOpening.ToDescription()); + + query = query.Where(kpi => projectStatuses.Any(projectStatus => kpi.ProjectStatusProjectStatus == projectStatus)); + } if (!string.IsNullOrEmpty(parameters.Wave)) query = query.Where(kpi => kpi.ProjectStatusFreeSchoolApplicationWave == parameters.Wave); diff --git a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API/UseCases/Project/ProjectMapper.cs b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API/UseCases/Project/ProjectMapper.cs index bf07e2820..feb960879 100644 --- a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API/UseCases/Project/ProjectMapper.cs +++ b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API/UseCases/Project/ProjectMapper.cs @@ -91,8 +91,8 @@ public static ProjectStatusType ToProjectStatusType(string projectStatus) "closed" => ProjectStatusType.Closed, "cancelled during pre-opening" => ProjectStatusType.Cancelled, "cancelled" => ProjectStatusType.Cancelled, - "withdrawn during pre-opening" => ProjectStatusType.WithdrawnDuringPreOpening, - "withdrawn in pre-opening" => ProjectStatusType.WithdrawnDuringPreOpening, + "withdrawn during pre-opening" => ProjectStatusType.WithdrawnInPreOpening, + "withdrawn in pre-opening" => ProjectStatusType.WithdrawnInPreOpening, "rejected at application stage" => ProjectStatusType.Rejected, "application competition stage" => ProjectStatusType.ApplicationCompetitionStage, "application stage" => ProjectStatusType.ApplicationStage, @@ -111,7 +111,7 @@ public static string FromProjectStatusType(ProjectStatusType projectStatus) ProjectStatusType.Open => "Open", ProjectStatusType.Closed => "Closed", ProjectStatusType.Cancelled => "Cancelled during pre-opening", - ProjectStatusType.WithdrawnDuringPreOpening => "Withdrawn in pre-opening", + ProjectStatusType.WithdrawnInPreOpening => "Withdrawn in pre-opening", ProjectStatusType.Rejected => "Rejected at application stage", ProjectStatusType.ApplicationCompetitionStage => "Application Competition stage", ProjectStatusType.ApplicationStage => "Application stage", diff --git a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Dashboard/DashboardBasePageModel.cs b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Dashboard/DashboardBasePageModel.cs index 65aff5360..4c628f104 100644 --- a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Dashboard/DashboardBasePageModel.cs +++ b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Dashboard/DashboardBasePageModel.cs @@ -131,7 +131,7 @@ private string BuildPaginationQuery() if (ProjectStatusSearchTerm.Count > 0) ProjectStatusSearchTerm.ForEach((m => query = query.Add("search-by-project-status", m))); - + return query.ToString(); } diff --git a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Dashboard/_Dashboard.cshtml b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Dashboard/_Dashboard.cshtml index 50f270285..e680809cd 100644 --- a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Dashboard/_Dashboard.cshtml +++ b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Dashboard/_Dashboard.cshtml @@ -7,7 +7,7 @@ var regionLabels = (from object region in regions select region.ToDescription()).ToList(); var projectStatuses = Enum.GetValues(typeof(ProjectStatus)); - var projectStatusLabels = (from object status in projectStatuses select status.ToDescription()).ToList(); + var projectStatusLabels = (from ProjectStatus status in projectStatuses select status.ToDescription()).ToList(); projectStatusLabels.Sort(); var projectManagerLabels = Model.ProjectManagers; diff --git a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/ProjectOverview.cshtml b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/ProjectOverview.cshtml index e8060a243..4addb99ab 100644 --- a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/ProjectOverview.cshtml +++ b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/ProjectOverview.cshtml @@ -39,11 +39,11 @@ @if (@Model.Project.ProjectStatus.ProjectStatus is ProjectStatus.Cancelled or ProjectStatus.Closed or - ProjectStatus.WithdrawnDuringPreOpening or + ProjectStatus.WithdrawnInPreOpening or ProjectStatus.WithdrawnDuringApplication) {
- @if (Model.Project.ProjectStatus.ProjectStatus == ProjectStatus.WithdrawnDuringPreOpening || + @if (Model.Project.ProjectStatus.ProjectStatus == ProjectStatus.WithdrawnInPreOpening || Model.Project.ProjectStatus.ProjectStatus == ProjectStatus.WithdrawnDuringApplication) {
diff --git a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/ProjectStatus/EditProjectStatus.cshtml b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/ProjectStatus/EditProjectStatus.cshtml index 4c842d97a..14ce1cfae 100644 --- a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/ProjectStatus/EditProjectStatus.cshtml +++ b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/ProjectStatus/EditProjectStatus.cshtml @@ -12,7 +12,7 @@ var isPresumptionProject = Model.Project.ProjectType.Contains("Presumption"); - ProjectStatus[] presumptionStatuses = [ProjectStatus.Cancelled, ProjectStatus.Closed, ProjectStatus.Open, ProjectStatus.Preopening, ProjectStatus.WithdrawnDuringPreOpening]; + ProjectStatus[] presumptionStatuses = [ProjectStatus.Cancelled, ProjectStatus.Closed, ProjectStatus.Open, ProjectStatus.Preopening, ProjectStatus.WithdrawnInPreOpening]; var projectStatusOptions = new List { @@ -42,7 +42,7 @@ new("project-status-withdrawn-application", ProjectStatus.WithdrawnDuringApplication, ProjectStatus.WithdrawnDuringApplication.ToDescription(), "For example, the trust withdrew their application.", true, "year-withdrawn-application", "year-withdrawn-application", "Date the project was withdrawn", "For example, 23 2 2021", Model.WithdrawnApplicationYear), - new("project-status-withdrawn", ProjectStatus.WithdrawnDuringPreOpening, ProjectStatus.WithdrawnDuringPreOpening.ToDescription(), "For example, the trust withdrew in the pre-opening stage.", true, + new("project-status-withdrawn", ProjectStatus.WithdrawnInPreOpening, ProjectStatus.WithdrawnInPreOpening.ToDescription(), "For example, the trust withdrew in the pre-opening stage.", true, "year-withdrawn-preopening", "year-withdrawn-preopening", "Date the project was withdrawn", "For example, 23 2 2021", Model.WithdrawnYear) }; } diff --git a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/ProjectStatus/EditProjectStatus.cshtml.cs b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/ProjectStatus/EditProjectStatus.cshtml.cs index f4ef42700..2fa58f7d0 100644 --- a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/ProjectStatus/EditProjectStatus.cshtml.cs +++ b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/ProjectStatus/EditProjectStatus.cshtml.cs @@ -73,7 +73,7 @@ public async Task OnGet() if (Project.ProjectStatus.ProjectStatus == ProjectStatusType.Cancelled) CancelledYear = Project.ProjectStatus.ProjectCancelledDate; - if(Project.ProjectStatus.ProjectStatus == ProjectStatusType.WithdrawnDuringPreOpening) + if(Project.ProjectStatus.ProjectStatus == ProjectStatusType.WithdrawnInPreOpening) WithdrawnYear = Project.ProjectStatus.ProjectWithdrawnDate; if (Project.ProjectStatus.ProjectStatus == ProjectStatusType.WithdrawnDuringApplication) @@ -93,7 +93,7 @@ public async Task OnPost() { CheckErrors(ClosedYearId, ProjectStatusType.Closed, ClosedYear); CheckErrors(CancelledYearId, ProjectStatusType.Cancelled, CancelledYear); - CheckErrors(WithdrawnPreopeningYearId, ProjectStatusType.WithdrawnDuringPreOpening, WithdrawnYear); + CheckErrors(WithdrawnPreopeningYearId, ProjectStatusType.WithdrawnInPreOpening, WithdrawnYear); CheckErrors(WithdrawnApplicationYearId, ProjectStatusType.WithdrawnDuringApplication, WithdrawnApplicationYear); ClearNotApplicableValues(); @@ -139,7 +139,7 @@ private void ClearNotApplicableValues() return; } - if (ProjectStatus == ProjectStatusType.WithdrawnDuringPreOpening) + if (ProjectStatus == ProjectStatusType.WithdrawnInPreOpening) { ClosedYear = null; CancelledYear = null; diff --git a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/TagHelpers/StatusTagHelper.cs b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/TagHelpers/StatusTagHelper.cs index 3d7e54798..76bc2ece7 100644 --- a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/TagHelpers/StatusTagHelper.cs +++ b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/TagHelpers/StatusTagHelper.cs @@ -31,7 +31,7 @@ public override void Process(TagHelperContext context, TagHelperOutput output) ProjectStatus.PreopeningNotIncludedInFigures => "yellow", ProjectStatus.Rejected => "orange", ProjectStatus.WithdrawnDuringApplication => "orange", - ProjectStatus.WithdrawnDuringPreOpening => "orange", + ProjectStatus.WithdrawnInPreOpening => "orange", _ => "grey" };