Skip to content

Commit

Permalink
Merge branch 'refs/heads/main' into feature/178419-ofsted-preregistra…
Browse files Browse the repository at this point in the history
…tion-actualdate

# Conflicts:
#	Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.Data/Entities/Milestones.cs
  • Loading branch information
zhodges-nimble committed Oct 7, 2024
2 parents 2ab1cdd + c4435e2 commit a32086f
Show file tree
Hide file tree
Showing 45 changed files with 13,459 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public class FundingAgreementHealthCheckTask
public bool? DraftedFundingAgreementHealthCheck { get; set; }
public bool? RegionalDirectorSignedOffFundingAgreementHealthCheck { get; set; }
public bool? MinisterSignedOffFundingAgreementHealthCheck { get; set; }
public bool? IncludedSignedOffImpactAssessment { get; set; }
public bool? SavedFundingAgreementHealthCheckInWorkplacesFolder { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ public class FundingAgreementSubmissionTask
public bool? DraftedFundingAgreementSubmission { get; set; }
public bool? RegionalDirectorSignedOffFundingAgreementSubmission { get; set; }
public bool? MinisterSignedOffFundingAgreementSubmission { get; set; }
public bool? IncludedSignedOffImpactAssessment { get; set; }
public bool? SavedFundingAgreementSubmissionInWorkplacesFolder { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public static Kpi BuildProject()
result.ProjectStatusUrnWhenGivenOne = _fixture.Create<string>();
result.ProjectStatusFreeSchoolApplicationWave = _fixture.Create<string>();
result.ProjectStatusRealisticYearOfOpening = _fixture.Create<string>();
result.RyooWd = result.ProjectStatusRealisticYearOfOpening;
result.ProjectStatusDateOfEntryIntoPreOpening = _fixture.Create<DateTime>();
result.ProjectStatusProvisionalOpeningDateAgreedWithTrust = _fixture.Create<DateTime>();
result.ProjectStatusActualOpeningDate = _fixture.Create<DateTime>();
Expand Down Expand Up @@ -83,8 +84,8 @@ public static Kpi BuildProjectMandatoryFieldsOnly()
UpperStatus = _fixture.Create<string>().Substring(0, 10),
FsType = _fixture.Create<string>().Substring(0, 13),
FsType1 = _fixture.Create<string>().Substring(0, 15),
MatUnitProjects = _fixture.Create<string>().Substring(0, 31),
SponsorUnitProjects = _fixture.Create<string>()
MatUnitProjects = "Other",
SponsorUnitProjects = "Free Schools (including Studio Schools)"
};

return result;
Expand Down Expand Up @@ -203,6 +204,7 @@ public static Milestones BuildFundingAgreementHealthCheckTask(string rid)
result.FsgPreOpeningMilestonesMfadDraftedFaHealthCheck = true;
result.FsgPreOpeningMilestonesMfadRegionalDirectorSignedOffFaHealthCheck = false;
result.FsgPreOpeningMilestonesMfadMinisterSignedOffFaHealthCheck = false;
result.FsgPreOpeningMilestonesMfadIncludedSignedOffImpactAssessmentFaHealthCheck = false;
result.FsgPreOpeningMilestonesMfadSavedFaHealthCheckInWorkplacesFolder = false;

return result;
Expand All @@ -217,6 +219,7 @@ public static Milestones BuildFundingAgreementSubmissionTask(string rid)
result.FsgPreOpeningMilestonesMfadDraftedFaSubmission = true;
result.FsgPreOpeningMilestonesMfadRegionalDirectorSignedOffFaSubmission = false;
result.FsgPreOpeningMilestonesMfadMinisterSignedOffFaSubmission = false;
result.FsgPreOpeningMilestonesMfadIncludedSignedOffImpactAssessmentFaSubmission = false;
result.FsgPreOpeningMilestonesMfadSavedFaSubmissionInWorkplacesFolder = false;

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public async Task When_CreateProject_Returns_NewProjectFields_201(ProjectType pr
createdProject.UpperStatus.Should().BeEmpty();
createdProject.FsType.Should().BeEmpty();
createdProject.FsType1.Should().BeEmpty();
createdProject.MatUnitProjects.Should().BeEmpty();
createdProject.SponsorUnitProjects.Should().BeEmpty();
createdProject.MatUnitProjects.Should().Be("Other");
createdProject.SponsorUnitProjects.Should().Be("Free Schools (including Studio Schools)");
createdProject.SchoolDetailsGeographicalRegion.Should().Be(projectDetails.Region);
createdProject.SchoolDetailsLocalAuthority.Should().Be(projectDetails.LocalAuthorityCode);
createdProject.LocalAuthority.Should().Be(projectDetails.LocalAuthority);
Expand Down Expand Up @@ -118,6 +118,8 @@ public async Task When_CreateProject_Returns_NewProjectFields_201(ProjectType pr
createdProject.ProjectStatusFreeSchoolsApplicationNumber.Should().BeEmpty();
createdProject.Wave.Should().Be("FS - Presumption");
}

createdProject.RyooWd.Should().Be("Awaiting Year");
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using Dfe.ManageFreeSchoolProjects.API.Contracts.Project.Tasks;
using Dfe.ManageFreeSchoolProjects.API.Tests.Fixtures;
using Dfe.ManageFreeSchoolProjects.API.Tests.Helpers;
using Dfe.ManageFreeSchoolProjects.API.Constants;
using System.Threading.Tasks;
using System;
using System.Linq;

namespace Dfe.ManageFreeSchoolProjects.API.Tests.Integration.Tasks
{
Expand Down Expand Up @@ -44,6 +46,47 @@ public async Task Patch_DatesTask_Returns_201()
projectResponse.Dates.ProjectClosedDate.Should().Be(DateTenDaysInFuture);
projectResponse.Dates.RealisticYearOfOpening.Should().Be(request.Dates.RealisticYearOfOpening);
projectResponse.SchoolName.Should().Be(project.ProjectStatusCurrentFreeSchoolName);

using var contextPostSave = _testFixture.GetContext();
var updatedProject = contextPostSave.Kpi.First(p => p.ProjectStatusProjectId == projectId);
updatedProject.RyooWd.Should().Be(request.Dates.RealisticYearOfOpening);
}

[Fact]
public async Task Patch_DatesTask_NoRYOOSetsDefaultValue()
{
var project = DatabaseModelBuilder.BuildProject();
var projectId = project.ProjectStatusProjectId;

using var context = _testFixture.GetContext();
context.Kpi.Add(project);
await context.SaveChangesAsync();

var DateTenDaysInFuture = new DateTime().AddDays(10);
var DateNineDaysInFuture = new DateTime().AddDays(9);

var request = new UpdateProjectByTaskRequest()
{
Dates = new DatesTask()
{
DateOfEntryIntoPreopening = DateTenDaysInFuture,
ProvisionalOpeningDateAgreedWithTrust = DateNineDaysInFuture,
ProjectClosedDate = DateTenDaysInFuture,
RealisticYearOfOpening = "",
}
};

var projectResponse = await _client.UpdateProjectTask(projectId, request, TaskName.Dates.ToString());

projectResponse.Dates.DateOfEntryIntoPreopening.Should().Be(DateTenDaysInFuture);
projectResponse.Dates.ProvisionalOpeningDateAgreedWithTrust.Should().Be(DateNineDaysInFuture);
projectResponse.Dates.ProjectClosedDate.Should().Be(DateTenDaysInFuture);
projectResponse.Dates.RealisticYearOfOpening.Should().Be(request.Dates.RealisticYearOfOpening);
projectResponse.SchoolName.Should().Be(project.ProjectStatusCurrentFreeSchoolName);

using var contextPostSave = _testFixture.GetContext();
var updatedProject = contextPostSave.Kpi.First(p => p.ProjectStatusProjectId == projectId);
updatedProject.RyooWd.Should().Be(ProjectConstants.RYOODefaultValue);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ public async Task Patch_FundingAgreementHealthCheck_Returns_201()
.Be(request.FundingAgreementHealthCheck.DraftedFundingAgreementHealthCheck);
projectResponse.FundingAgreementHealthCheck.RegionalDirectorSignedOffFundingAgreementHealthCheck.Should()
.Be(request.FundingAgreementHealthCheck.RegionalDirectorSignedOffFundingAgreementHealthCheck);
projectResponse.FundingAgreementHealthCheck.RegionalDirectorSignedOffFundingAgreementHealthCheck.Should()
.Be(request.FundingAgreementHealthCheck.RegionalDirectorSignedOffFundingAgreementHealthCheck);
projectResponse.FundingAgreementHealthCheck.MinisterSignedOffFundingAgreementHealthCheck.Should()
.Be(request.FundingAgreementHealthCheck.MinisterSignedOffFundingAgreementHealthCheck);
projectResponse.FundingAgreementHealthCheck.IncludedSignedOffImpactAssessment.Should()
.Be(request.FundingAgreementHealthCheck.IncludedSignedOffImpactAssessment);
projectResponse.FundingAgreementHealthCheck.SavedFundingAgreementHealthCheckInWorkplacesFolder.Should()
.Be(request.FundingAgreementHealthCheck.SavedFundingAgreementHealthCheckInWorkplacesFolder);

Expand All @@ -65,7 +67,9 @@ public async Task Patch_ExistingFundingArrangement_Returns_201()
FundingAgreementHealthCheck = new FundingAgreementHealthCheckTask()
{
DraftedFundingAgreementHealthCheck = true,
RegionalDirectorSignedOffFundingAgreementHealthCheck = true,
RegionalDirectorSignedOffFundingAgreementHealthCheck = false,
MinisterSignedOffFundingAgreementHealthCheck = true,
IncludedSignedOffImpactAssessment = true,
SavedFundingAgreementHealthCheckInWorkplacesFolder = true
}
};
Expand All @@ -77,8 +81,10 @@ public async Task Patch_ExistingFundingArrangement_Returns_201()
.Be(request.FundingAgreementHealthCheck.DraftedFundingAgreementHealthCheck);
projectResponse.FundingAgreementHealthCheck.RegionalDirectorSignedOffFundingAgreementHealthCheck.Should()
.Be(request.FundingAgreementHealthCheck.RegionalDirectorSignedOffFundingAgreementHealthCheck);
projectResponse.FundingAgreementHealthCheck.RegionalDirectorSignedOffFundingAgreementHealthCheck.Should()
.Be(request.FundingAgreementHealthCheck.RegionalDirectorSignedOffFundingAgreementHealthCheck);
projectResponse.FundingAgreementHealthCheck.MinisterSignedOffFundingAgreementHealthCheck.Should()
.Be(request.FundingAgreementHealthCheck.MinisterSignedOffFundingAgreementHealthCheck);
projectResponse.FundingAgreementHealthCheck.IncludedSignedOffImpactAssessment.Should()
.Be(request.FundingAgreementHealthCheck.IncludedSignedOffImpactAssessment);
projectResponse.FundingAgreementHealthCheck.SavedFundingAgreementHealthCheckInWorkplacesFolder.Should()
.Be(request.FundingAgreementHealthCheck.SavedFundingAgreementHealthCheckInWorkplacesFolder);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ public async Task Patch_FundingAgreementSubmission_Returns_201()
.Be(request.FundingAgreementSubmission.DraftedFundingAgreementSubmission);
projectResponse.FundingAgreementSubmission.RegionalDirectorSignedOffFundingAgreementSubmission.Should()
.Be(request.FundingAgreementSubmission.RegionalDirectorSignedOffFundingAgreementSubmission);
projectResponse.FundingAgreementSubmission.RegionalDirectorSignedOffFundingAgreementSubmission.Should()
.Be(request.FundingAgreementSubmission.RegionalDirectorSignedOffFundingAgreementSubmission);
projectResponse.FundingAgreementSubmission.MinisterSignedOffFundingAgreementSubmission.Should()
.Be(request.FundingAgreementSubmission.MinisterSignedOffFundingAgreementSubmission);
projectResponse.FundingAgreementSubmission.IncludedSignedOffImpactAssessment.Should()
.Be(request.FundingAgreementSubmission.IncludedSignedOffImpactAssessment);
projectResponse.FundingAgreementSubmission.SavedFundingAgreementSubmissionInWorkplacesFolder.Should()
.Be(request.FundingAgreementSubmission.SavedFundingAgreementSubmissionInWorkplacesFolder);

Expand All @@ -65,7 +67,9 @@ public async Task Patch_ExistingFundingArrangement_Returns_201()
FundingAgreementSubmission = new FundingAgreementSubmissionTask()
{
DraftedFundingAgreementSubmission = true,
RegionalDirectorSignedOffFundingAgreementSubmission = true,
RegionalDirectorSignedOffFundingAgreementSubmission = false,
MinisterSignedOffFundingAgreementSubmission = true,
IncludedSignedOffImpactAssessment = true,
SavedFundingAgreementSubmissionInWorkplacesFolder = true
}
};
Expand All @@ -77,8 +81,10 @@ public async Task Patch_ExistingFundingArrangement_Returns_201()
.Be(request.FundingAgreementSubmission.DraftedFundingAgreementSubmission);
projectResponse.FundingAgreementSubmission.RegionalDirectorSignedOffFundingAgreementSubmission.Should()
.Be(request.FundingAgreementSubmission.RegionalDirectorSignedOffFundingAgreementSubmission);
projectResponse.FundingAgreementSubmission.RegionalDirectorSignedOffFundingAgreementSubmission.Should()
.Be(request.FundingAgreementSubmission.RegionalDirectorSignedOffFundingAgreementSubmission);
projectResponse.FundingAgreementSubmission.MinisterSignedOffFundingAgreementSubmission.Should()
.Be(request.FundingAgreementSubmission.MinisterSignedOffFundingAgreementSubmission);
projectResponse.FundingAgreementSubmission.IncludedSignedOffImpactAssessment.Should()
.Be(request.FundingAgreementSubmission.IncludedSignedOffImpactAssessment);
projectResponse.FundingAgreementSubmission.SavedFundingAgreementSubmissionInWorkplacesFolder.Should()
.Be(request.FundingAgreementSubmission.SavedFundingAgreementSubmissionInWorkplacesFolder);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using Dfe.ManageFreeSchoolProjects.API.Contracts.Project.Tasks;
using Dfe.ManageFreeSchoolProjects.API.Tests.Fixtures;
using Dfe.ManageFreeSchoolProjects.API.Tests.Helpers;
using Dfe.ManageFreeSchoolProjects.API.Constants;
using System;
using System.Linq;
using System.Threading.Tasks;

namespace Dfe.ManageFreeSchoolProjects.API.Tests.Integration.Tasks
Expand Down Expand Up @@ -42,6 +44,10 @@ public async Task Patch_NewKickOffMeeting_Returns_201()
projectResponse.KickOffMeeting.RealisticYearOfOpening.Should().Be(request.KickOffMeeting.RealisticYearOfOpening);
projectResponse.KickOffMeeting.FundingArrangementAgreed.Should().Be(request.KickOffMeeting.FundingArrangementAgreed);
projectResponse.KickOffMeeting.FundingArrangementDetailsAgreed.Should().Be(request.KickOffMeeting.FundingArrangementDetailsAgreed);

using var contextPostSave = _testFixture.GetContext();
var updatedProject = contextPostSave.Kpi.First(p => p.ProjectStatusProjectId == projectId);
updatedProject.RyooWd.Should().Be(request.KickOffMeeting.RealisticYearOfOpening);
}

[Fact]
Expand Down Expand Up @@ -77,6 +83,49 @@ public async Task Patch_ExistingKickOffMeeting_Returns_201()
projectResponse.KickOffMeeting.RealisticYearOfOpening.Should().Be(request.KickOffMeeting.RealisticYearOfOpening);
projectResponse.KickOffMeeting.FundingArrangementAgreed.Should().Be(request.KickOffMeeting.FundingArrangementAgreed);
projectResponse.KickOffMeeting.FundingArrangementDetailsAgreed.Should().Be(request.KickOffMeeting.FundingArrangementDetailsAgreed);

using var contextPostSave = _testFixture.GetContext();
var updatedProject = contextPostSave.Kpi.First(p => p.ProjectStatusProjectId == projectId);
updatedProject.RyooWd.Should().Be(request.KickOffMeeting.RealisticYearOfOpening);
}

[Fact]
public async Task Patch_ExistingKickOffMeeting_NoRYOOSetsDefaultValue()
{
var project = DatabaseModelBuilder.BuildProject();
var projectId = project.ProjectStatusProjectId;

using var context = _testFixture.GetContext();
context.Kpi.Add(project);

var kickOffMeetingTask = DatabaseModelBuilder.BuildKickOffMeetingTask(project.Rid);
context.Milestones.Add(kickOffMeetingTask);

await context.SaveChangesAsync();

var dateNineDaysInFuture = new DateTime().AddDays(9);

var request = new UpdateProjectByTaskRequest()
{
KickOffMeeting = new KickOffMeetingTask()
{
FundingArrangementAgreed = true,
RealisticYearOfOpening = "",
FundingArrangementDetailsAgreed = "text",
SavedDocumentsInWorkplacesFolder = true
}
};

var projectResponse = await _client.UpdateProjectTask(projectId, request, TaskName.KickOffMeeting.ToString());

projectResponse.KickOffMeeting.SavedDocumentsInWorkplacesFolder.Should().Be(request.KickOffMeeting.SavedDocumentsInWorkplacesFolder);
projectResponse.KickOffMeeting.RealisticYearOfOpening.Should().Be(request.KickOffMeeting.RealisticYearOfOpening);
projectResponse.KickOffMeeting.FundingArrangementAgreed.Should().Be(request.KickOffMeeting.FundingArrangementAgreed);
projectResponse.KickOffMeeting.FundingArrangementDetailsAgreed.Should().Be(request.KickOffMeeting.FundingArrangementDetailsAgreed);

using var contextPostSave = _testFixture.GetContext();
var updatedProject = contextPostSave.Kpi.First(p => p.ProjectStatusProjectId == projectId);
updatedProject.RyooWd.Should().Be(ProjectConstants.RYOODefaultValue);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Dfe.ManageFreeSchoolProjects.API.Constants
{
public static class ProjectConstants
{
public const string RYOODefaultValue = "Awaiting Year";
public const string MATUnitProjects = "Other";
public const string SponsorUnitProjects = "Free Schools (including Studio Schools)";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Dfe.ManageFreeSchoolProjects.API.UseCases.Tasks;
using Dfe.ManageFreeSchoolProjects.Data;
using Dfe.ManageFreeSchoolProjects.Data.Entities.Existing;
using Dfe.ManageFreeSchoolProjects.API.Constants;
using Microsoft.EntityFrameworkCore;

namespace Dfe.ManageFreeSchoolProjects.API.UseCases.Project
Expand Down Expand Up @@ -83,6 +84,7 @@ private Po MapToPo(ProjectDetails proj, string rid)

private static Kpi MapToKpi(ProjectDetails proj, string rid, Trust trust)
{

return new Kpi
{
Rid = rid,
Expand All @@ -96,8 +98,8 @@ private static Kpi MapToKpi(ProjectDetails proj, string rid, Trust trust)
UpperStatus = "",
FsType = "",
FsType1 = "",
MatUnitProjects = "",
SponsorUnitProjects = "",
MatUnitProjects = ProjectConstants.MATUnitProjects,
SponsorUnitProjects = ProjectConstants.SponsorUnitProjects,
SchoolDetailsGeographicalRegion = proj.Region,
SchoolDetailsLocalAuthority = proj.LocalAuthorityCode,
LocalAuthority = proj.LocalAuthority,
Expand All @@ -122,6 +124,8 @@ private static Kpi MapToKpi(ProjectDetails proj, string rid, Trust trust)
ProjectStatusProvisionalOpeningDateAgreedWithTrust = proj.ProvisionalOpeningDate,
KeyContactsFsgLeadContact = proj.ProjectAssignedToName,
KeyContactsFsgLeadContactEmail = proj.ProjectAssignedToEmail,
RyooWd = ProjectConstants.RYOODefaultValue

};
}

Expand Down
Loading

0 comments on commit a32086f

Please sign in to comment.