Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ FROM AdminUsers
SelfAssessmentFrameworks saf2
INNER JOIN Frameworks f ON f.ID = saf2.FrameworkId
WHERE
saf2.SelfAssessmentId = sa.ID
saf2.SelfAssessmentId = sa.ID AND saf2.RemovedDate IS NULL
FOR XML PATH(''), TYPE).value('.', 'NVARCHAR(MAX)'), 1, 2, ''
) AS LinkedFrameworks,
(SELECT ProfessionalGroup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,12 @@ public IActionResult SelectFrameworkSources(SelectFrameworkSourcesFormData model
{
var adminId = GetAdminID();
var competencyAssessmentId = model.CompetencyAssessmentId;
if (!ModelState.IsValid)
if (!ModelState.IsValid || (model.FrameworkId == 0 && model.ActionName == "AddFramework"))
{

if (model.FrameworkId == 0 && model.ActionName == "AddFramework")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of doing this, please do the validation in the Model (make the frameworkid nullable so that it can't accept zero as a value. you'll have to change in cshtml as well where a default value of zero is provided)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

{
ModelState.AddModelError(nameof(model.FrameworkId), "You must select the framework sources you wish to add to the competency assessment");
}
var frameworks = frameworkService.GetAllFrameworks(adminId);
var competencyAssessmentBase = competencyAssessmentService.GetCompetencyAssessmentBaseById(competencyAssessmentId, adminId);
if (competencyAssessmentBase == null)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@using DigitalLearningSolutions.Web.ViewModels.CompetencyAssessments
@model SelectFrameworkSourcesViewModel;
@{
var errorHasOccurred = !ViewData.ModelState.IsValid;
ViewData["Title"] = "Select Framework Sources";
ViewData["Application"] = "Framework Service";
}
Expand Down Expand Up @@ -29,6 +30,15 @@
}
</style>

<div class="nhsuk-grid-row">
<div class="nhsuk-grid-column-full">
@if (errorHasOccurred)
{
<vc:error-summary order-of-property-names="@(new[] { nameof(Model.FrameworkId) })" />
}

</div>
</div>
<h1>Select framework sources for @Model.CompetencyAssessmentName</h1>
<dl class="nhsuk-summary-list">
@if (Model.PrimaryFramework != null)
Expand Down
Loading