-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #869 from DFE-Digital/feature/178419-ofsted-prereg…
…istration-actualdate 178419 - Build: Ofsted pre-registration, change fields & add actual date inspections completed
- Loading branch information
Showing
18 changed files
with
13,126 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 23 additions & 29 deletions
52
...Projects.API/UseCases/Project/Tasks/OfstedInspection/UpdateOfstedInspectionTaskService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,54 @@ | ||
| ||
using Dfe.ManageFreeSchoolProjects.API.Contracts.Common; | ||
using Dfe.ManageFreeSchoolProjects.API.Extensions; | ||
using Dfe.ManageFreeSchoolProjects.Data; | ||
using Dfe.ManageFreeSchoolProjects.Data.Entities.Existing; | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace Dfe.ManageFreeSchoolProjects.API.UseCases.Project.Tasks.OfstedInspection | ||
{ | ||
public class UpdateOfstedInspectionTaskService : IUpdateTaskService | ||
public class UpdateOfstedInspectionTaskService(MfspContext context) : IUpdateTaskService | ||
{ | ||
|
||
private readonly MfspContext _context; | ||
|
||
public UpdateOfstedInspectionTaskService(MfspContext context) | ||
{ | ||
_context = context; | ||
} | ||
|
||
public async Task Update(UpdateTaskServiceParameters parameters) | ||
{ | ||
var task = parameters.Request.OfstedInspection; | ||
var dbKpi = parameters.Kpi; | ||
|
||
if (task is null) | ||
{ | ||
return; | ||
} | ||
|
||
var db = await _context.Milestones.FirstOrDefaultAsync(r => r.Rid == dbKpi.Rid); | ||
|
||
var db = await context.Milestones.FirstOrDefaultAsync(r => r.Rid == dbKpi.Rid); | ||
|
||
if (db == null) | ||
{ | ||
db = new Data.Entities.Existing.Milestones(); | ||
db.Rid = dbKpi.Rid; | ||
_context.Add(db); | ||
db = new Milestones { Rid = dbKpi.Rid }; | ||
context.Add(db); | ||
} | ||
|
||
db.FsgPreOpeningMilestonesProcessDetailsProvided = task.ProcessDetailsProvided; | ||
db.FsgPreOpeningMilestonesInspectionBlockDecided = task.InspectionBlockDecided; | ||
db.FsgPreOpeningMilestonesOfstedAndTrustLiaisonDetailsConfirmed = task.OfstedAndTrustLiaisonDetailsConfirmed; | ||
db.FsgPreOpeningMilestonesBlockAndContentDetailsToOpenersSpreadSheet = task.BlockAndContentDetailsToOpenersSpreadSheet; | ||
db.FsgPreOpeningMilestonesSharedOutcomeWithTrust = task.SharedOutcomeWithTrust; | ||
db.FsgPreOpeningMilestonesInspectionConditionsMet = InspectionConditionsMet(task.InspectionConditionsMet); | ||
db.FsgPreOpeningMilestonesProposedToOpenOnGias = task.ProposedToOpenOnGias; | ||
db.FsgPreOpeningMilestonesDocumentsAndG6SavedToWorkplaces = task.SavedToWorkplaces; | ||
} | ||
|
||
private static string InspectionConditionsMet(bool? conditionMet) | ||
{ | ||
switch (conditionMet) | ||
db.FsgPreOpeningMilestonesOprActualDateOfCompletion = task.DateInspectionsAndAnyActionsCompleted; | ||
|
||
|
||
switch (task.InspectionConditionsMet) | ||
{ | ||
case true: | ||
return "Yes"; | ||
case false: | ||
return "No"; | ||
case YesNoNotApplicable.Yes or YesNoNotApplicable.No: | ||
db.FsgPreOpeningMilestonesInspectionConditionsMet = task.InspectionConditionsMet.ToDescription(); | ||
db.FsgPreOpeningInspectionConditionsMetNotApplicable = null; | ||
break; | ||
case YesNoNotApplicable.NotApplicable: | ||
db.FsgPreOpeningInspectionConditionsMetNotApplicable = task.InspectionConditionsMet.ToDescription(); | ||
db.FsgPreOpeningMilestonesInspectionConditionsMet = null; | ||
break; | ||
default: | ||
return null; | ||
db.FsgPreOpeningInspectionConditionsMetNotApplicable = null; | ||
db.FsgPreOpeningMilestonesInspectionConditionsMet = null; | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.