Skip to content

Commit

Permalink
Merge pull request #262 from DFE-Digital/feature/124581-sponsored-pfi…
Browse files Browse the repository at this point in the history
…-default

Feature/124581 sponsored pfi default
  • Loading branch information
dneed-nimble authored Jun 1, 2023
2 parents 388f4e7 + 2bd3415 commit 8c60714
Showing 10 changed files with 1,531 additions and 19 deletions.

Large diffs are not rendered by default.

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

#nullable disable

namespace Dfe.Academies.Academisation.Data.Migrations
{
/// <inheritdoc />
public partial class PfiSchemeDetails : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "PfiSchemeDetails",
schema: "academisation",
table: "Project",
type: "nvarchar(max)",
nullable: true);
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "PfiSchemeDetails",
schema: "academisation",
table: "Project");
}
}
}
Original file line number Diff line number Diff line change
@@ -17,18 +17,18 @@ protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.7")
.HasAnnotation("ProductVersion", "7.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 128);

SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);

modelBuilder.Entity("Dfe.Academies.Academisation.Data.ConversionAdvisoryBoardDecisionAggregate.ConversionAdvisoryBoardDecisionDeclinedReasonState", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");

SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

b.Property<int>("AdvisoryBoardDecisionId")
.HasColumnType("int");
@@ -60,7 +60,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.ValueGeneratedOnAdd()
.HasColumnType("int");

SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

b.Property<int>("AdvisoryBoardDecisionId")
.HasColumnType("int");
@@ -92,7 +92,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.ValueGeneratedOnAdd()
.HasColumnType("int");

SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

b.Property<DateTime>("AdvisoryBoardDecisionDate")
.HasColumnType("datetime2");
@@ -131,7 +131,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.ValueGeneratedOnAdd()
.HasColumnType("int");

SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

b.Property<string>("Author")
.HasColumnType("nvarchar(max)");
@@ -161,7 +161,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.ValueGeneratedOnAdd()
.HasColumnType("int");

SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

b.Property<string>("AcademyOrderRequired")
.HasColumnType("nvarchar(max)");
@@ -331,6 +331,9 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<decimal?>("PercentageOfGoodOrOutstandingSchoolsInTheDiocesanTrust")
.HasColumnType("decimal(18,2)");

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

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

@@ -447,7 +450,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.ValueGeneratedOnAdd()
.HasColumnType("int");

SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

b.Property<string>("ApplicationReference")
.ValueGeneratedOnAddOrUpdate()
@@ -499,7 +502,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.ValueGeneratedOnAdd()
.HasColumnType("int");

SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

b.Property<int?>("ConversionApplicationId")
.HasColumnType("int");
@@ -526,7 +529,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.ValueGeneratedOnAdd()
.HasColumnType("int");

SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

b.Property<int?>("ApplicationSchoolId")
.HasColumnType("int");
@@ -578,7 +581,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.ValueGeneratedOnAdd()
.HasColumnType("int");

SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

b.Property<decimal>("Amount")
.HasColumnType("decimal(18,2)");
@@ -623,7 +626,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.ValueGeneratedOnAdd()
.HasColumnType("int");

SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

b.Property<int?>("ConversionApplicationId")
.HasColumnType("int");
@@ -701,7 +704,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.ValueGeneratedOnAdd()
.HasColumnType("int");

SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime2");
@@ -723,7 +726,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.ValueGeneratedOnAdd()
.HasColumnType("int");

SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

b.Property<bool?>("ChangesToLaGovernance")
.HasColumnType("bit");
@@ -768,7 +771,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.ValueGeneratedOnAdd()
.HasColumnType("int");

SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

b.Property<int?>("ApplicationFormTrustId")
.HasColumnType("int");
@@ -806,7 +809,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.ValueGeneratedOnAdd()
.HasColumnType("int");

SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

b.Property<int?>("ApplicationFormTrustKeyPersonRoleId")
.HasColumnType("int");
Original file line number Diff line number Diff line change
@@ -60,6 +60,7 @@ public class ProjectState : BaseEntity
public string? PublishedAdmissionNumber { get; set; }
public decimal? PercentageFreeSchoolMeals { get; set; }
public string? PartOfPfiScheme { get; set; }
public string? PfiSchemeDetails { get; set; }
public string? ViabilityIssues { get; set; }
public string? FinancialDeficit { get; set; }
public string? DiocesanTrust { get; set; }
@@ -181,6 +182,7 @@ public Project MapToDomain()
PublishedAdmissionNumber = PublishedAdmissionNumber,
PercentageFreeSchoolMeals = PercentageFreeSchoolMeals,
PartOfPfiScheme = PartOfPfiScheme,
PfiSchemeDetails = PfiSchemeDetails,
ViabilityIssues = ViabilityIssues,
FinancialDeficit = FinancialDeficit,
DiocesanTrust = DiocesanTrust,
@@ -308,6 +310,7 @@ public static ProjectState MapFromDomain(IProject project)
PublishedAdmissionNumber = project.Details.PublishedAdmissionNumber,
PercentageFreeSchoolMeals = project.Details.PercentageFreeSchoolMeals,
PartOfPfiScheme = project.Details.PartOfPfiScheme,
PfiSchemeDetails = project.Details.PfiSchemeDetails,
ViabilityIssues = project.Details.ViabilityIssues,
FinancialDeficit = project.Details.FinancialDeficit,
DiocesanTrust = project.Details.DiocesanTrust,
Original file line number Diff line number Diff line change
@@ -55,6 +55,7 @@ public sealed class ProjectDetails : IEquatable<ProjectDetails>
public string? PublishedAdmissionNumber { get; init; }
public decimal? PercentageFreeSchoolMeals { get; init; }
public string? PartOfPfiScheme { get; init; }
public string? PfiSchemeDetails { get; init; }
public string? ViabilityIssues { get; init; }
public string? FinancialDeficit { get; init; }
public string? DiocesanTrust { get; init; }
Original file line number Diff line number Diff line change
@@ -142,7 +142,7 @@ public static CreateResult CreateInvoluntaryProject(InvoluntaryProject project)
NameOfTrust = project.Trust?.Name,
AcademyTypeAndRoute = "Sponsored",
ConversionSupportGrantAmount = 25000,
PartOfPfiScheme = ToYesNoString(project.School?.PartOfPfiScheme)
PartOfPfiScheme = ToYesNoString(project.School?.PartOfPfiScheme) ?? "No"
};

return new CreateSuccessResult<IProject>(new Project(projectDetails));
@@ -215,6 +215,7 @@ public CommandResult Update(ProjectDetails detailsToUpdate)
PublishedAdmissionNumber = detailsToUpdate.PublishedAdmissionNumber,
PercentageFreeSchoolMeals = detailsToUpdate.PercentageFreeSchoolMeals,
PartOfPfiScheme = detailsToUpdate.PartOfPfiScheme,
PfiSchemeDetails = detailsToUpdate.PfiSchemeDetails,
ViabilityIssues = detailsToUpdate.ViabilityIssues,
FinancialDeficit = detailsToUpdate.FinancialDeficit,
DiocesanTrust = detailsToUpdate.DiocesanTrust,
@@ -295,7 +296,7 @@ public CommandResult Update(ProjectDetails detailsToUpdate)

private static string? ToYesNoString(bool? value)
{
if (!value.HasValue) return null;
if (value.HasValue is false) return null;
return value == true ? "Yes" : "No";
}

Original file line number Diff line number Diff line change
@@ -59,6 +59,7 @@ public LegacyProjectServiceModel(int id, int urn)
public string? PublishedAdmissionNumber { get; init; }
[JsonIgnore] public decimal? PercentageFreeSchoolMeals { get; init; }
public string? PartOfPfiScheme { get; init; }
public string? PfiSchemeDetails { get; init; }
public string? ViabilityIssues { get; init; }
public string? FinancialDeficit { get; init; }
[JsonIgnore] public string? DiocesanTrust { get; init; }
Original file line number Diff line number Diff line change
@@ -71,6 +71,7 @@ internal static ProjectDetails MapNonEmptyFields(this LegacyProjectServiceModel
PublishedAdmissionNumber = detailsToUpdate.PublishedAdmissionNumber ?? existingProject.Details.PublishedAdmissionNumber,
PercentageFreeSchoolMeals = detailsToUpdate.PercentageFreeSchoolMeals ?? existingProject.Details.PercentageFreeSchoolMeals,
PartOfPfiScheme = detailsToUpdate.PartOfPfiScheme ?? existingProject.Details.PartOfPfiScheme,
PfiSchemeDetails = detailsToUpdate.PfiSchemeDetails ?? existingProject.Details.PfiSchemeDetails,
ViabilityIssues = detailsToUpdate.ViabilityIssues ?? existingProject.Details.ViabilityIssues,
FinancialDeficit = detailsToUpdate.FinancialDeficit ?? existingProject.Details.FinancialDeficit,
DiocesanTrust = detailsToUpdate.DiocesanTrust ?? existingProject.Details.DiocesanTrust,
Original file line number Diff line number Diff line change
@@ -62,6 +62,7 @@ internal static LegacyProjectServiceModel MapToServiceModel(this IProject projec
PublishedAdmissionNumber = project.Details.PublishedAdmissionNumber,
PercentageFreeSchoolMeals = project.Details.PercentageFreeSchoolMeals,
PartOfPfiScheme = project.Details.PartOfPfiScheme,
PfiSchemeDetails = project.Details.PfiSchemeDetails,
ViabilityIssues = project.Details.ViabilityIssues,
FinancialDeficit = project.Details.FinancialDeficit,
DiocesanTrust = project.Details.DiocesanTrust,
Original file line number Diff line number Diff line change
@@ -124,13 +124,15 @@ public async Task ProjectExists___PartialProjectIsUpdated()

var getResult = await legacyProjectController.Get(updatedProject.Id);

(_, var getProject) = DfeAssert.OkObjectResult(getResult);
(_, LegacyProjectServiceModel getProject) = DfeAssert.OkObjectResult(getResult);

existingProject.ProjectStatus = updatedProject.ProjectStatus;
existingProject.EqualitiesImpactAssessmentConsidered = updatedProject.EqualitiesImpactAssessmentConsidered;

Assert.Multiple(
() => Assert.Equal(existingProject.HeadTeacherBoardDate, getProject.HeadTeacherBoardDate),
() => Assert.Equal(existingProject.PartOfPfiScheme, getProject.PartOfPfiScheme),
() => Assert.Equal(existingProject.PfiSchemeDetails, getProject.PfiSchemeDetails),
() => Assert.Equal(existingProject.Author, getProject.Author),
() => Assert.Equal(existingProject.ClearedBy, getProject.ClearedBy),
() => Assert.Equal(existingProject.ProposedAcademyOpeningDate, getProject.ProposedAcademyOpeningDate),

0 comments on commit 8c60714

Please sign in to comment.