Skip to content

Commit

Permalink
Merge pull request #274 from DFE-Digital/132060-opening-date-removal-…
Browse files Browse the repository at this point in the history
…of-field

removal of opening date field
  • Loading branch information
danielryannimble authored Jun 26, 2023
2 parents b3e5cb6 + b6a6f7c commit 49e6a30
Show file tree
Hide file tree
Showing 15 changed files with 1,504 additions and 26 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Dfe.Academies.Academisation.Data.Migrations
{
/// <inheritdoc />
public partial class Remove_OpeningDate_Field : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "OpeningDate",
schema: "academisation",
table: "Project");
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "OpeningDate",
schema: "academisation",
table: "Project",
type: "datetime2",
nullable: true);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,6 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<string>("NameOfTrust")
.HasColumnType("nvarchar(max)");

b.Property<DateTime?>("OpeningDate")
.HasColumnType("datetime2");

b.Property<string>("PartOfPfiScheme")
.HasColumnType("nvarchar(max)");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public class ProjectState : BaseEntity
public DateTime? ApplicationReceivedDate { get; set; }
public DateTime? AssignedDate { get; set; }
public DateTime? HeadTeacherBoardDate { get; set; }
public DateTime? OpeningDate { get; set; }
public DateTime? BaselineDate { get; set; }

//la summary page
Expand Down Expand Up @@ -138,8 +137,7 @@ public Project MapToDomain()
ProjectStatus = ProjectStatus,
ApplicationReceivedDate = ApplicationReceivedDate,
AssignedDate = AssignedDate,
HeadTeacherBoardDate = HeadTeacherBoardDate,
OpeningDate = OpeningDate,
HeadTeacherBoardDate = HeadTeacherBoardDate,
BaselineDate = BaselineDate,

// la summary page
Expand Down Expand Up @@ -266,7 +264,6 @@ public static ProjectState MapFromDomain(IProject project)
ApplicationReceivedDate = project.Details.ApplicationReceivedDate,
AssignedDate = project.Details.AssignedDate,
HeadTeacherBoardDate = project.Details.HeadTeacherBoardDate,
OpeningDate = project.Details.OpeningDate,
BaselineDate = project.Details.BaselineDate,

// la summary page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public sealed class ProjectDetails : IEquatable<ProjectDetails>
public DateTime? ApplicationReceivedDate { get; init; }
public DateTime? AssignedDate { get; init; }
public DateTime? HeadTeacherBoardDate { get; init; }
public DateTime? OpeningDate { get; init; }
public DateTime? BaselineDate { get; init; }
public DateTime? LocalAuthorityInformationTemplateSentDate { get; init; }
public DateTime? LocalAuthorityInformationTemplateReturnedDate { get; init; }
Expand Down Expand Up @@ -119,7 +118,7 @@ public bool Equals(ProjectDetails? other)
Nullable.Equals(ApplicationReceivedDate, other.ApplicationReceivedDate) &&
Nullable.Equals(AssignedDate, other.AssignedDate) &&
Nullable.Equals(HeadTeacherBoardDate, other.HeadTeacherBoardDate) &&
Nullable.Equals(OpeningDate, other.OpeningDate) && Nullable.Equals(BaselineDate, other.BaselineDate) &&
Nullable.Equals(ProposedAcademyOpeningDate, other.ProposedAcademyOpeningDate) && Nullable.Equals(BaselineDate, other.BaselineDate) &&
Nullable.Equals(LocalAuthorityInformationTemplateSentDate,
other.LocalAuthorityInformationTemplateSentDate) &&
Nullable.Equals(LocalAuthorityInformationTemplateReturnedDate,
Expand Down Expand Up @@ -249,7 +248,7 @@ public override int GetHashCode()
hashCode.Add(ApplicationReceivedDate);
hashCode.Add(AssignedDate);
hashCode.Add(HeadTeacherBoardDate);
hashCode.Add(OpeningDate);
hashCode.Add(ProposedAcademyOpeningDate);
hashCode.Add(BaselineDate);
hashCode.Add(LocalAuthorityInformationTemplateSentDate);
hashCode.Add(Form7Received, StringComparer.InvariantCultureIgnoreCase);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
{
public record SponsoredProject(SponsoredProjectSchool? School, SponsoredProjectTrust? Trust);
public record SponsoredProjectTrust(string Name, string ReferenceNumber);
public record SponsoredProjectSchool(string Name, int Urn, DateTime? OpeningDate, bool? PartOfPfiScheme, string? LocalAuthorityName, string? Region);
public record SponsoredProjectSchool(string Name, int Urn, DateTime? ProposedAcademyOpeningDate, bool? PartOfPfiScheme, string? LocalAuthorityName, string? Region);
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ public void Create_JoinAMatApplicationType___ReturnsCreateSuccessResult()
() => Assert.Equal($"A2B_{application.ApplicationId}", project.Details.ApplicationReferenceNumber),
() => Assert.Equal("Converter Pre-AO (C)", project.Details.ProjectStatus),
() => Assert.Equal(application.ApplicationSubmittedDate, project.Details.ApplicationReceivedDate),
() => Assert.Equal(DateTime.Today.AddMonths(6), project.Details.OpeningDate),
() => Assert.Equal(application.JoinTrust?.TrustReference, project.Details.TrustReferenceNumber),
() => Assert.Equal(application.JoinTrust?.TrustName, project.Details.NameOfTrust),
() => Assert.Equal("Converter", project.Details.AcademyTypeAndRoute),
Expand Down
10 changes: 3 additions & 7 deletions Dfe.Academies.Academisation.Domain/ProjectAggregate/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ public static CreateResult Create(IApplication application)
SchoolName = school.SchoolName,
ApplicationReferenceNumber = $"A2B_{application.ApplicationId}",
ProjectStatus = "Converter Pre-AO (C)",
ApplicationReceivedDate = application.ApplicationSubmittedDate,
OpeningDate = DateTime.Today.AddMonths(6),
ApplicationReceivedDate = application.ApplicationSubmittedDate,
TrustReferenceNumber = application.JoinTrust?.TrustReference,
NameOfTrust = application.JoinTrust?.TrustName,
AcademyTypeAndRoute = "Converter",
Expand Down Expand Up @@ -88,8 +87,7 @@ public static CreateResult CreateFormAMat(IApplication application)
SchoolName = school.Details.SchoolName,
ApplicationReferenceNumber = $"A2B_{application.ApplicationId}",
ProjectStatus = "Converter Pre-AO (C)",
ApplicationReceivedDate = application.ApplicationSubmittedDate,
OpeningDate = DateTime.Today.AddMonths(6),
ApplicationReceivedDate = application.ApplicationSubmittedDate,
NameOfTrust = application.FormTrust?.TrustDetails.FormTrustProposedNameOfTrust,
AcademyTypeAndRoute = "Form a Mat",
ProposedAcademyOpeningDate = school.Details.ConversionTargetDate,
Expand Down Expand Up @@ -138,7 +136,6 @@ public static CreateResult CreateSponsoredProject(SponsoredProject project)
Urn = project.School.Urn,
SchoolName = project.School?.Name,
ProjectStatus = "Converter Pre-AO (C)",
OpeningDate = DateTime.Today.AddMonths(6),
TrustReferenceNumber = project.Trust?.ReferenceNumber,
NameOfTrust = project.Trust?.Name,
AcademyTypeAndRoute = "Sponsored",
Expand Down Expand Up @@ -171,8 +168,7 @@ public CommandResult Update(ProjectDetails detailsToUpdate)
ProjectStatus = detailsToUpdate.ProjectStatus,
ApplicationReceivedDate = detailsToUpdate.ApplicationReceivedDate,
AssignedDate = detailsToUpdate.AssignedDate,
HeadTeacherBoardDate = detailsToUpdate.HeadTeacherBoardDate,
OpeningDate = detailsToUpdate.OpeningDate,
HeadTeacherBoardDate = detailsToUpdate.HeadTeacherBoardDate,
BaselineDate = detailsToUpdate.BaselineDate,

// la summary page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public LegacyProjectServiceModel(int id, int urn)
public DateTime? ApplicationReceivedDate { get; init; }
public DateTime? AssignedDate { get; init; }
public DateTime? HeadTeacherBoardDate { get; init; }
public DateTime? OpeningDate { get; init; }
public DateTime? BaselineDate { get; init; }
public DateTime? LocalAuthorityInformationTemplateSentDate { get; init; }
public DateTime? LocalAuthorityInformationTemplateReturnedDate { get; init; }
Expand Down Expand Up @@ -123,7 +122,6 @@ public bool Equals(LegacyProjectServiceModel? other)
Nullable.Equals(ApplicationReceivedDate, other.ApplicationReceivedDate) &&
Nullable.Equals(AssignedDate, other.AssignedDate) &&
Nullable.Equals(HeadTeacherBoardDate, other.HeadTeacherBoardDate) &&
Nullable.Equals(OpeningDate, other.OpeningDate) &&
Nullable.Equals(BaselineDate, other.BaselineDate) &&
Nullable.Equals(LocalAuthorityInformationTemplateSentDate,
other.LocalAuthorityInformationTemplateSentDate) &&
Expand Down Expand Up @@ -259,7 +257,6 @@ public override int GetHashCode()
hashCode.Add(ApplicationReceivedDate);
hashCode.Add(AssignedDate);
hashCode.Add(HeadTeacherBoardDate);
hashCode.Add(OpeningDate);
hashCode.Add(BaselineDate);
hashCode.Add(LocalAuthorityInformationTemplateSentDate);
hashCode.Add(LocalAuthorityInformationTemplateReturnedDate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class SponsoredProjectSchoolServiceModel
{
public string? Name { get; init; }
public int Urn { get; init; }
public DateTime OpeningDate { get; init; }
public DateTime ProposedAcademyOpeningDate { get; init; }
public bool PartOfPfiScheme { get; init; }
public string? LocalAuthorityName { get; init; }
public string? Region{ get; init; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ internal static ProjectDetails MapNonEmptyFields(this LegacyProjectServiceModel
ApplicationReceivedDate = detailsToUpdate.ApplicationReceivedDate ?? existingProject.Details.ApplicationReceivedDate,
AssignedDate = detailsToUpdate.AssignedDate ?? existingProject.Details.AssignedDate,
HeadTeacherBoardDate = detailsToUpdate.HeadTeacherBoardDate.Equals(default(DateTime)) ? null : detailsToUpdate.HeadTeacherBoardDate ?? existingProject.Details.HeadTeacherBoardDate,
OpeningDate = detailsToUpdate.OpeningDate ?? existingProject.Details.OpeningDate,
BaselineDate = detailsToUpdate.BaselineDate ?? existingProject.Details.BaselineDate,

// la summary page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ internal static LegacyProjectServiceModel MapToServiceModel(this IProject projec
ApplicationReceivedDate = project.Details.ApplicationReceivedDate,
AssignedDate = project.Details.AssignedDate,
HeadTeacherBoardDate = project.Details.HeadTeacherBoardDate,
OpeningDate = project.Details.OpeningDate,
BaselineDate = project.Details.BaselineDate,

// la summary page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ private static void AssertProject(ApplicationSchoolServiceModel school, LegacyPr
{
Assert.Multiple(
() => Assert.Equal("Converter Pre-AO (C)", project.ProjectStatus),
() => Assert.Equal(DateTime.Today.AddMonths(6), project.OpeningDate),
() => Assert.Equal(type, project.AcademyTypeAndRoute),
() => Assert.Equal(school.SchoolConversionTargetDate, project.ProposedAcademyOpeningDate),
() => Assert.Equal(25000.0m, project.ConversionSupportGrantAmount),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public void CanMap_JoinTrust_MapFromDomainToServiceModel()

// Assert
Assert.NotNull(result);

result.Should().BeEquivalentTo(joinTrustDomainObj);
}

Expand Down
1 change: 1 addition & 0 deletions release-notes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## 9.0.1
* Fixed Bug 132060 : Added Migration to remove the 'Opening Date' field from projects. The 'ProposedAcademyOpeningDate' field will now be used throughout the api.
* Added migration to change projects with status of "APPROVED WITH CONDITIONS" to "Approved with conditions"

---
Expand Down

0 comments on commit 49e6a30

Please sign in to comment.