Skip to content

Commit

Permalink
Merge pull request #845 from DFE-Digital/feature/178422
Browse files Browse the repository at this point in the history
Feature/178422 Principal designate expected date field and visibility on presumption projects
  • Loading branch information
sukhybhullar-nimble authored Sep 27, 2024
2 parents 75cebe3 + eb8966f commit 6aa7f21
Show file tree
Hide file tree
Showing 12 changed files with 129 additions and 159 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ namespace Dfe.ManageFreeSchoolProjects.API.Contracts.Project.Tasks;

public class PrincipalDesignateTask
{
public YesNoNotApplicable? CommissionedExternalExpertVisitToSchool { get; set; }

public DateTime? ExpectedDatePrincipalDesignateAppointed { get; set; }

public bool? TrustAppointedPrincipalDesignate { get; set; }

public bool? TrustAppointedPrincipleDesignate { get; set; }

public DateTime? TrustAppointedPrincipleDesignateDate { get; set; }
public DateTime? ActualDatePrincipalDesignateAppointed { get; set; }

public YesNoNotApplicable? CommissionedExternalExpertVisitToSchool { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,22 @@ public async Task Patch_NewPrincipalDesignate_Returns_201()
{
PrincipalDesignate = new PrincipalDesignateTask()
{
TrustAppointedPrincipleDesignateDate = new DateTime().AddDays(9),
CommissionedExternalExpertVisitToSchool = YesNoNotApplicable.Yes
ActualDatePrincipalDesignateAppointed = new DateTime().AddDays(9),
CommissionedExternalExpertVisitToSchool = YesNoNotApplicable.Yes,
ExpectedDatePrincipalDesignateAppointed = new DateTime().AddDays(8),
}
};

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

projectResponse.PrincipalDesignate.TrustAppointedPrincipleDesignate.Should()
projectResponse.PrincipalDesignate.TrustAppointedPrincipalDesignate.Should()
.Be(true);
projectResponse.PrincipalDesignate.TrustAppointedPrincipleDesignateDate.Should()
.Be(request.PrincipalDesignate.TrustAppointedPrincipleDesignateDate);
projectResponse.PrincipalDesignate.ActualDatePrincipalDesignateAppointed.Should()
.Be(request.PrincipalDesignate.ActualDatePrincipalDesignateAppointed);
projectResponse.PrincipalDesignate.CommissionedExternalExpertVisitToSchool.Should()
.Be(request.PrincipalDesignate.CommissionedExternalExpertVisitToSchool);
projectResponse.PrincipalDesignate.ExpectedDatePrincipalDesignateAppointed.Should()
.Be(request.PrincipalDesignate.ExpectedDatePrincipalDesignateAppointed);
}

[Fact]
Expand All @@ -60,9 +63,10 @@ public async Task Patch_ExistingPrincipalDesignate_Returns_201()
{
PrincipalDesignate = new PrincipalDesignateTask()
{
TrustAppointedPrincipleDesignate = false,
TrustAppointedPrincipleDesignateDate = null,
CommissionedExternalExpertVisitToSchool = YesNoNotApplicable.No
TrustAppointedPrincipalDesignate = false,
ActualDatePrincipalDesignateAppointed = null,
CommissionedExternalExpertVisitToSchool = YesNoNotApplicable.No,
ExpectedDatePrincipalDesignateAppointed = new DateTime().AddDays(8),
}
};

Expand All @@ -71,12 +75,14 @@ public async Task Patch_ExistingPrincipalDesignate_Returns_201()

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

projectResponse.PrincipalDesignate.TrustAppointedPrincipleDesignate.Should()
projectResponse.PrincipalDesignate.TrustAppointedPrincipalDesignate.Should()
.Be(false);
projectResponse.PrincipalDesignate.TrustAppointedPrincipleDesignateDate.Should()
projectResponse.PrincipalDesignate.ActualDatePrincipalDesignateAppointed.Should()
.Be(null);
projectResponse.PrincipalDesignate.CommissionedExternalExpertVisitToSchool.Should()
.Be(request.PrincipalDesignate.CommissionedExternalExpertVisitToSchool);
projectResponse.PrincipalDesignate.ExpectedDatePrincipalDesignateAppointed.Should()
.Be(request.PrincipalDesignate.ExpectedDatePrincipalDesignateAppointed);
}

}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,21 @@ public static PrincipalDesignateTask Build(Milestones milestones)

if (milestones.FsgPreOpeningMilestonesAppointedPrincipalDesignate == null && milestones.FsgPreOpeningMilestonesPdappActualDateOfCompletion.HasValue)
{
principleDesignateTask.TrustAppointedPrincipleDesignate =
principleDesignateTask.TrustAppointedPrincipalDesignate =
true;
}

else
{
principleDesignateTask.TrustAppointedPrincipleDesignate =
principleDesignateTask.TrustAppointedPrincipalDesignate =
milestones.FsgPreOpeningMilestonesAppointedPrincipalDesignate;
}

principleDesignateTask.TrustAppointedPrincipleDesignateDate =
principleDesignateTask.ActualDatePrincipalDesignateAppointed =
milestones.FsgPreOpeningMilestonesPdappActualDateOfCompletion;
principleDesignateTask.CommissionedExternalExpertVisitToSchool =
milestones.FsgPreOpeningMilestonesCommissionedExternalExpertVisitToSchool;
principleDesignateTask.ExpectedDatePrincipalDesignateAppointed = milestones.FsgPreOpeningMilestonesPdappForecastDate;

return principleDesignateTask;
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ public async Task Update(UpdateTaskServiceParameters parameters)
_context.Add(db);
}

db.FsgPreOpeningMilestonesAppointedPrincipalDesignate = task.TrustAppointedPrincipleDesignate;
db.FsgPreOpeningMilestonesPdappActualDateOfCompletion = task.TrustAppointedPrincipleDesignateDate;
db.FsgPreOpeningMilestonesAppointedPrincipalDesignate = task.TrustAppointedPrincipalDesignate;
db.FsgPreOpeningMilestonesPdappActualDateOfCompletion = task.ActualDatePrincipalDesignateAppointed;
db.FsgPreOpeningMilestonesCommissionedExternalExpertVisitToSchool = task.CommissionedExternalExpertVisitToSchool;
db.FsgPreOpeningMilestonesPdappForecastDate = task.ExpectedDatePrincipalDesignateAppointed;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ private static ProjectByTaskSummaryResponse BuildProjectByTaskSummaryResponse(Kp
MovingToOpen = SafeRetrieveTaskSummary(projectTasks, TaskName.MovingToOpen.ToString()),
DueDiligenceChecks = SafeRetrieveTaskSummary(projectTasks, TaskName.DueDiligenceChecks.ToString()),
PreFundingAgreementCheckpointMeeting = SafeRetrieveTaskSummary(projectTasks, TaskName.PreFundingAgreementCheckpointMeeting.ToString()),
ReadinessToOpenMeeting = SafeRetrieveTaskSummary(projectTasks, TaskName.ReadinessToOpenMeeting.ToString())
ReadinessToOpenMeeting = SafeRetrieveTaskSummary(projectTasks, TaskName.ReadinessToOpenMeeting.ToString()),
PrincipalDesignate = SafeRetrieveTaskSummary(projectTasks, TaskName.PrincipalDesignate.ToString())
};

var applicationsEvidenceTask = SafeRetrieveTaskSummary(projectTasks, TaskName.ApplicationsEvidence.ToString());
Expand All @@ -97,7 +98,6 @@ private static ProjectByTaskSummaryResponse BuildProjectByTaskSummaryResponse(Kp
var fundingAgreementSubmissionTask = SafeRetrieveTaskSummary(projectTasks, "FundingAgreementSubmission");

result.ApplicationsEvidence = BuildApplicationsEvidenceTask(applicationsEvidenceTask, dbKpi);
result.PrincipalDesignate = BuildPrincipleDesignateTask(principalDesignateTask, dbKpi);
result.FundingAgreementHealthCheck =
BuildFundingAgreementHealthCheckTask(fundingAgreementHealthCheckTask, dbKpi);
result.FundingAgreementSubmission = BuildFundingAgreementSubmissionTask(fundingAgreementSubmissionTask, dbKpi);
Expand Down Expand Up @@ -137,21 +137,6 @@ private static TaskSummaryResponse BuildApplicationsEvidenceTask(TaskSummaryResp
return result;
}

private static TaskSummaryResponse BuildPrincipleDesignateTask(TaskSummaryResponse taskSummaryResponse, Kpi kpi)
{
var parameters = new PrincipalDesignateTaskSummaryBuilderParameters()
{
ApplicationWave = kpi.ProjectStatusFreeSchoolApplicationWave,
TaskSummary = taskSummaryResponse
};

var result = new PrincipalDesignateTaskSummaryBuilder().Build(parameters);

_tasksCount -= taskSummaryResponse.IsHidden ? 1 : 0;

return result;
}

private static TaskSummaryResponse BuildFundingAgreementHealthCheckTask(TaskSummaryResponse taskSummaryResponse,
Kpi kpi)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe("Testing Principal designate task", () => {
beforeEach(() => {
cy.login();

project = RequestBuilder.createProjectDetailsNonPresumption();
project = RequestBuilder.createProjectDetails();

projectApi
.post({
Expand All @@ -25,7 +25,7 @@ describe("Testing Principal designate task", () => {

it("Should be able to set a Principal designate", () => {

Logger.log("Select finance plan");
Logger.log("Select principal designate");
taskListPage.isTaskStatusIsNotStarted("PrincipalDesignate")
.selectPrincipleDesignateFromTaskList();

Expand All @@ -34,8 +34,10 @@ describe("Testing Principal designate task", () => {
.schoolNameIs(project.schoolName)
.titleIs("Principal designate")
.inOrder()
.summaryShows("Trust has appointed a principal designate").IsEmpty().HasChangeLink()
.summaryShows("Commissioned an external expert").IsEmpty().HasChangeLink()
.summaryShows("Expected date that principal designate will be appointed").IsEmpty().HasChangeLink()
.summaryShows("Trust has appointed a principal designate").IsEmpty().HasChangeLink()
.summaryShows("Actual date that principal designate was appointed").IsEmpty().HasChangeLink()
.isNotMarkedAsComplete();

cy.log("Go back to task list");
Expand All @@ -51,7 +53,6 @@ describe("Testing Principal designate task", () => {
taskListPage.isTaskStatusInProgress("PrincipalDesignate")
.selectPrincipleDesignateFromTaskList();


summaryPage.clickChange();

cy.log("Check empty values accepted");
Expand All @@ -63,23 +64,25 @@ describe("Testing Principal designate task", () => {
.schoolNameIs(project.schoolName)
.titleIs("Principal designate")
.inOrder()
.summaryShows("Trust has appointed a principal designate").IsEmpty().HasChangeLink()
.summaryShows("Commissioned an external expert").IsEmpty().HasChangeLink()
.summaryShows("Expected date that principal designate will be appointed").IsEmpty().HasChangeLink()
.summaryShows("Trust has appointed a principal designate").IsEmpty().HasChangeLink()
.summaryShows("Actual date that principal designate was appointed").IsEmpty().HasChangeLink()
.isNotMarkedAsComplete()
.clickChange()

cy.log("Check validation for principal designate");
cy.log("Check validation for actual principal designate date");

editPrincipalDesignatePage
.checkYesForPrincipleDesignate()
.clickContinue()
.errorForPrincipleDesignateAppointedDate().showsError("Enter the actual date a principal designate was appointed")
.errorForPrincipleDesignateAppointedDate().showsError("Enter the actual date that principal designate was appointed")
.withPrincipleDesignateAppointedDate("24","","")
.clickContinue()
.errorForPrincipleDesignateAppointedDate().showsError("Trust appointed principal designate date must include a month and year")
.errorForPrincipleDesignateAppointedDate().showsError("Actual date that principal designate was appointed must include a month and year")
.withPrincipleDesignateAppointedDate("24","4","")
.clickContinue()
.errorForPrincipleDesignateAppointedDate().showsError("Trust appointed principal designate date must include a year")
.errorForPrincipleDesignateAppointedDate().showsError("Actual date that principal designate was appointed must include a year")
.withPrincipleDesignateAppointedDate("24","4","2049")
.checkYesForExternalExpert()
.clickContinue()
Expand All @@ -88,14 +91,38 @@ describe("Testing Principal designate task", () => {
.schoolNameIs(project.schoolName)
.titleIs("Principal designate")
.inOrder()
.summaryShows("Trust has appointed a principal designate").HasValue("Yes").HasChangeLink()
.summaryShows("Date that the trust appointed principal designate").HasValue("24 April 2049").HasChangeLink()
.summaryShows("Commissioned an external expert").HasValue("Yes").HasChangeLink()
.summaryShows("Expected date that principal designate will be appointed").IsEmpty().HasChangeLink()
.summaryShows("Trust has appointed a principal designate").HasValue("Yes").HasChangeLink()
.summaryShows("Actual date that principal designate was appointed").HasValue("24 April 2049").HasChangeLink()
.isNotMarkedAsComplete();

summaryPage.clickChange();
//
cy.log("Check validation for expected principal designate date");

editPrincipalDesignatePage
.withExpectedPrincipleDesignateAppointedDate("25","","")
.clickContinue()
.errorForExpectedPrincipleDesignateAppointedDate().showsError("Expected date that principal designate will be appointed must include a month and year")
.withExpectedPrincipleDesignateAppointedDate("25","4","")
.clickContinue()
.errorForExpectedPrincipleDesignateAppointedDate().showsError("Expected date that principal designate will be appointed must include a year")
.withExpectedPrincipleDesignateAppointedDate("25","4","2049")
.clickContinue()

summaryPage
.schoolNameIs(project.schoolName)
.titleIs("Principal designate")
.inOrder()
.summaryShows("Commissioned an external expert").HasValue("Yes").HasChangeLink()
.summaryShows("Expected date that principal designate will be appointed").HasValue("25 April 2049").HasChangeLink()
.summaryShows("Trust has appointed a principal designate").HasValue("Yes").HasChangeLink()
.summaryShows("Actual date that principal designate was appointed").HasValue("24 April 2049").HasChangeLink()
.isNotMarkedAsComplete();

summaryPage.clickChange();
//
editPrincipalDesignatePage
.checkNoForPrincipleDesignate()
.checkNotApplicableForExternalExpert()
Expand All @@ -105,8 +132,10 @@ describe("Testing Principal designate task", () => {
.schoolNameIs(project.schoolName)
.titleIs("Principal designate")
.inOrder()
.summaryShows("Trust has appointed a principal designate").HasValue("No").HasChangeLink()
.summaryShows("Commissioned an external expert").HasValue("Not applicable").HasChangeLink()
.summaryShows("Expected date that principal designate will be appointed").HasValue("25 April 2049").HasChangeLink()
.summaryShows("Trust has appointed a principal designate").HasValue("Yes").HasChangeLink()
.summaryShows("Actual date that principal designate was appointed").HasValue("24 April 2049").HasChangeLink()
.isNotMarkedAsComplete()

cy.log("can edit principal designate");
Expand All @@ -115,16 +144,19 @@ describe("Testing Principal designate task", () => {


editPrincipalDesignatePage
.checkNoForPrincipleDesignate()
.checkNoForExternalExpert()
.checkNoForPrincipleDesignate()
.withPrincipleDesignateAppointedDate("", "", "")
.clickContinue()

summaryPage
.schoolNameIs(project.schoolName)
.titleIs("Principal designate")
.inOrder()
.summaryShows("Trust has appointed a principal designate").HasValue("No").HasChangeLink()
.summaryShows("Commissioned an external expert").HasValue("No").HasChangeLink()
.summaryShows("Expected date that principal designate will be appointed").HasValue("25 April 2049").HasChangeLink()
.summaryShows("Trust has appointed a principal designate").IsEmpty().HasChangeLink()
.summaryShows("Actual date that principal designate was appointed").IsEmpty().HasChangeLink()
.isNotMarkedAsComplete()
.MarkAsComplete()
.clickConfirmAndContinue()
Expand Down
Loading

0 comments on commit 6aa7f21

Please sign in to comment.