From 7edf2a646fc5a1b73c2ed25289e0a204df2dcbee Mon Sep 17 00:00:00 2001 From: kevwhitt-hee Date: Wed, 5 Mar 2025 08:04:01 +0000 Subject: [PATCH 1/3] TD-5389 role profile links page implemented --- .../CompetencyAssessmentDataService.cs | 53 +++- .../CompetencyAssessments/NRPSubGroups.cs | 1 - .../CompetencyAssessments.cs | 83 ++++-- .../Services/CompetencyAssessmentService.cs | 27 +- .../EditRoleProfileLinksViewModel.cs | 43 +++ .../ProfessionalGroupViewModel.cs | 11 - .../EditRoleProfileLinks.cshtml | 256 ++++++++++++++++++ .../ManageCompetencyAssessment.cshtml | 2 +- .../ProfessionalGroup.cshtml | 135 --------- 9 files changed, 422 insertions(+), 189 deletions(-) create mode 100644 DigitalLearningSolutions.Web/ViewModels/CompetencyAssessments/EditRoleProfileLinksViewModel.cs delete mode 100644 DigitalLearningSolutions.Web/ViewModels/CompetencyAssessments/ProfessionalGroupViewModel.cs create mode 100644 DigitalLearningSolutions.Web/Views/CompetencyAssessments/EditRoleProfileLinks.cshtml delete mode 100644 DigitalLearningSolutions.Web/Views/CompetencyAssessments/ProfessionalGroup.cshtml diff --git a/DigitalLearningSolutions.Data/DataServices/CompetencyAssessmentDataService.cs b/DigitalLearningSolutions.Data/DataServices/CompetencyAssessmentDataService.cs index 2a7fc8723b..983bdba073 100644 --- a/DigitalLearningSolutions.Data/DataServices/CompetencyAssessmentDataService.cs +++ b/DigitalLearningSolutions.Data/DataServices/CompetencyAssessmentDataService.cs @@ -23,13 +23,15 @@ public interface ICompetencyAssessmentDataService CompetencyAssessmentBase? GetCompetencyAssessmentBaseByName(string competencyAssessmentName, int adminId); CompetencyAssessment? GetCompetencyAssessmentById(int competencyAssessmentId, int adminId); IEnumerable GetNRPProfessionalGroups(); + IEnumerable GetNRPSubGroups(int? nRPProfessionalGroupID); + IEnumerable GetNRPRoles(int? nRPSubGroupID); CompetencyAssessmentTaskStatus GetOrInsertAndReturnAssessmentTaskStatus(int assessmentId, bool frameworkBased); //UPDATE DATA bool UpdateCompetencyAssessmentName(int competencyAssessmentId, int adminId, string competencyAssessmentName); - bool UpdateCompetencyAssessmentProfessionalGroup(int competencyAssessmentId, int adminId, int? nrpProfessionalGroupID); + bool UpdateCompetencyRoleProfileLinks(int competencyAssessmentId, int adminId, int? professionalGroupId, int? subGroupId, int? roleId); bool UpdateCompetencyAssessmentBranding( int competencyAssessmentId, int adminId, @@ -41,6 +43,7 @@ int categoryId bool UpdateIntroductoryTextTaskStatus(int assessmentId, bool taskStatus); bool UpdateBrandingTaskStatus(int assessmentId, bool taskStatus); bool UpdateVocabularyTaskStatus(int assessmentId, bool taskStatus); + bool UpdateRoleProfileLinksTaskStatus(int assessmentId, bool taskStatus); //INSERT DATA int InsertCompetencyAssessment(int adminId, int centreId, string competencyAssessmentName); bool InsertSelfAssessmentFramework(int adminId, int selfAssessmentId, int frameworkId); @@ -225,11 +228,11 @@ ORDER BY ProfessionalGroup" ).FirstOrDefault(); } - public bool UpdateCompetencyAssessmentProfessionalGroup(int competencyAssessmentId, int adminId, int? nrpProfessionalGroupID) + public bool UpdateCompetencyRoleProfileLinks(int competencyAssessmentId, int adminId, int? professionalGroupId, int? subGroupId, int? roleId) { var result = connection.ExecuteScalar( - @"SELECT COUNT(*) FROM CompetencyAssessments WHERE ID = @competencyAssessmentId AND NRPProfessionalGroupID = @nrpProfessionalGroupID", - new { competencyAssessmentId, nrpProfessionalGroupID } + @"SELECT COUNT(*) FROM SelfAssessments WHERE ID = @competencyAssessmentId AND NRPProfessionalGroupID = @professionalGroupId AND NRPSubGroupID = @subGroupId AND NRPRoleID = @roleId", + new { competencyAssessmentId, professionalGroupId, subGroupId, roleId } ); int sameCount = Convert.ToInt32(result); if (sameCount > 0) @@ -240,9 +243,9 @@ public bool UpdateCompetencyAssessmentProfessionalGroup(int competencyAssessment //needs updating: var numberOfAffectedRows = connection.Execute( - @"UPDATE SelfAssessments SET NRPProfessionalGroupID = @nrpProfessionalGroupID, NRPSubGroupID = NULL, NRPRoleID = NULL, UpdatedByAdminID = @adminId + @"UPDATE SelfAssessments SET NRPProfessionalGroupID = @professionalGroupId, NRPSubGroupID = @subGroupId, NRPRoleID = @roleId, UpdatedByAdminID = @adminId WHERE ID = @competencyAssessmentId", - new { nrpProfessionalGroupID, adminId, competencyAssessmentId } + new { adminId, competencyAssessmentId, professionalGroupId, subGroupId, roleId } ); if (numberOfAffectedRows > 0) { @@ -418,5 +421,43 @@ public bool UpdateVocabularyTaskStatus(int assessmentId, bool taskStatus) } return true; } + + public IEnumerable GetNRPSubGroups(int? nRPProfessionalGroupID) + { + return connection.Query( + @"SELECT ID, SubGroup, Active + FROM NRPSubGroups + WHERE (Active = 1) AND (NRPProfessionalGroupID = @nRPProfessionalGroupID) + ORDER BY SubGroup", new { nRPProfessionalGroupID } + ); + } + + public IEnumerable GetNRPRoles(int? nRPSubGroupID) + { + return connection.Query( + @"SELECT ID, RoleProfile AS ProfileName, Active + FROM NRPRoles + WHERE (Active = 1) AND (NRPSubGroupID = @nRPSubGroupID) + ORDER BY RoleProfile", new { nRPSubGroupID } + ); + } + + public bool UpdateRoleProfileLinksTaskStatus(int assessmentId, bool taskStatus) + { + var numberOfAffectedRows = connection.Execute( + @"UPDATE SelfAssessmentTaskStatus SET NationalRoleProfileTaskStatus = @taskStatus + WHERE SelfAssessmentId = @assessmentId", + new { assessmentId, taskStatus } + ); + if (numberOfAffectedRows < 1) + { + logger.LogWarning( + "Not updating NationalRoleProfileTaskStatus as db update failed. " + + $"assessmentId: {assessmentId}, taskStatus: {taskStatus}" + ); + return false; + } + return true; + } } } diff --git a/DigitalLearningSolutions.Data/Models/CompetencyAssessments/NRPSubGroups.cs b/DigitalLearningSolutions.Data/Models/CompetencyAssessments/NRPSubGroups.cs index fda19bcb09..f100a6b2e2 100644 --- a/DigitalLearningSolutions.Data/Models/CompetencyAssessments/NRPSubGroups.cs +++ b/DigitalLearningSolutions.Data/Models/CompetencyAssessments/NRPSubGroups.cs @@ -4,7 +4,6 @@ public class NRPSubGroups { public int ID { get; set; } - public int NRPProfessionalGroupID { get; set; } [StringLength(255, MinimumLength = 3)] [Required] public string SubGroup { get; set; } = string.Empty; diff --git a/DigitalLearningSolutions.Web/Controllers/CompetencyAssessmentsController/CompetencyAssessments.cs b/DigitalLearningSolutions.Web/Controllers/CompetencyAssessmentsController/CompetencyAssessments.cs index 652f2e087e..855a123e4a 100644 --- a/DigitalLearningSolutions.Web/Controllers/CompetencyAssessmentsController/CompetencyAssessments.cs +++ b/DigitalLearningSolutions.Web/Controllers/CompetencyAssessmentsController/CompetencyAssessments.cs @@ -14,6 +14,7 @@ using Microsoft.AspNetCore.Mvc.Rendering; using DigitalLearningSolutions.Data.Models.Centres; using DigitalLearningSolutions.Data.Models.Frameworks; + using Microsoft.CodeAnalysis.CSharp.Syntax; public partial class CompetencyAssessmentsController { @@ -187,10 +188,9 @@ public IActionResult ManageCompetencyAssessment(int competencyAssessmentId, int? return View("ManageCompetencyAssessment", model); } - [Route("/CompetencyAssessments/ProfessionalGroup/{actionName}/{competencyAssessmentId}")] - [Route("/CompetencyAssessments/ProfessionalGroup/{actionName}")] + [Route("/CompetencyAssessments/{competencyAssessmentId}/NationalRoleProfileLinks/{actionName}")] [SetSelectedTab(nameof(NavMenuTab.CompetencyAssessments))] - public IActionResult CompetencyAssessmentProfessionalGroup(string actionName, int competencyAssessmentId = 0) + public IActionResult EditRoleProfileLinks(int competencyAssessmentId = 0, string actionName = "EditGroup") { var adminId = GetAdminID(); CompetencyAssessmentBase? competencyAssessmentBase; @@ -212,45 +212,68 @@ public IActionResult CompetencyAssessmentProfessionalGroup(string actionName, in competencyAssessmentBase = competencyAssessmentService.GetCompetencyAssessmentBaseById(competencyAssessmentId, adminId); } var professionalGroups = competencyAssessmentService.GetNRPProfessionalGroups(); - var model = new ProfessionalGroupViewModel() - { - NRPProfessionalGroups = professionalGroups, - CompetencyAssessmentBase = competencyAssessmentBase - }; - return View("ProfessionalGroup", model); + var subGroups = competencyAssessmentService.GetNRPSubGroups(competencyAssessmentBase.NRPProfessionalGroupID); + var roles = competencyAssessmentService.GetNRPRoles(competencyAssessmentBase.NRPSubGroupID); + var competencyAssessmentTaskStatus = competencyAssessmentService.GetCompetencyAssessmentTaskStatus(competencyAssessmentId, null); + var model = new EditRoleProfileLinksViewModel(competencyAssessmentBase, professionalGroups, subGroups, roles, actionName, competencyAssessmentTaskStatus.NationalRoleProfileTaskStatus); + return View(model); } [HttpPost] - [Route("/CompetencyAssessments/ProfessionalGroup/{actionName}/{competencyAssessmentId}")] - [Route("/CompetencyAssessments/ProfessionalGroup/{actionName}")] - [SetSelectedTab(nameof(NavMenuTab.CompetencyAssessments))] - public IActionResult SaveProfessionalGroup(CompetencyAssessmentBase competencyAssessmentBase, string actionName, int competencyAssessmentId = 0) + [Route("/CompetencyAssessments/{competencyAssessmentId}/NationalRoleProfileLinks/{actionName}")] + public IActionResult EditRoleProfileLinks(EditRoleProfileLinksViewModel model, string actionName, int competencyAssessmentId = 0) { - if (competencyAssessmentBase.NRPProfessionalGroupID == null) + var adminId = GetAdminID(); + var competencyAssessmentBase = competencyAssessmentService.GetCompetencyAssessmentBaseById(competencyAssessmentId, adminId); + competencyAssessmentService.UpdateRoleProfileLinksTaskStatus(model.ID, model.TaskStatus ?? false); + if (competencyAssessmentBase == null) { - ModelState.Remove(nameof(CompetencyAssessmentBase.NRPProfessionalGroupID)); - ModelState.AddModelError(nameof(CompetencyAssessmentBase.NRPProfessionalGroupID), "Please choose a professional group" + (competencyAssessmentId == 0 ? "or Skip this step" : "") + "."); - // do something - return View("Name", competencyAssessmentBase); + logger.LogWarning($"Failed to submit role links page for competencyAssessmentId: {competencyAssessmentId} adminId: {adminId}"); + return StatusCode(500); } - if (actionName == "New") + if (competencyAssessmentBase.UserRole < 2) { - //TO DO Store to self assessment - - return RedirectToAction("CompetencyAssessmentSubGroup", "CompetencyAssessments", new { actionName }); + return StatusCode(403); } - else + if (competencyAssessmentBase.NRPProfessionalGroupID != model.ProfessionalGroupId) { - var adminId = GetAdminID(); - var isUpdated = competencyAssessmentService.UpdateCompetencyAssessmentProfessionalGroup(competencyAssessmentBase.ID, adminId, competencyAssessmentBase.NRPProfessionalGroupID); - if (isUpdated) + model.SubGroupId = null; + model.RoleId = null; + } + if (competencyAssessmentBase.NRPSubGroupID != model.SubGroupId) + { + model.RoleId = null; + } + var isUpdated = competencyAssessmentService.UpdateCompetencyRoleProfileLinks(model.ID, adminId, model.ProfessionalGroupId, model.SubGroupId, model.RoleId); + if (model.ActionName == "EditGroup") + { + if(model.ProfessionalGroupId == null) { - return RedirectToAction("CompetencyAssessmentSubGroup", "CompetencyAssessments", new { actionName, competencyAssessmentId }); + return RedirectToAction("EditRoleProfileLinks", new { actionName = "Summary", competencyAssessmentId }); } else { - return RedirectToAction("ManageCompetencyAssessment", new { tabname = "Details", competencyAssessmentId }); + return RedirectToAction("EditRoleProfileLinks", new { actionName = "EditSubGroup", competencyAssessmentId }); + } + } + else if (model.ActionName == "EditSubGroup") + { + if (model.SubGroupId == null) + { + return RedirectToAction("EditRoleProfileLinks", new { actionName = "Summary", competencyAssessmentId }); } + else + { + return RedirectToAction("EditRoleProfileLinks", new { actionName = "EditRole", competencyAssessmentId }); + } + } + else if (model.ActionName == "EditRole") + { + return RedirectToAction("EditRoleProfileLinks", new { actionName = "Summary", competencyAssessmentId }); + } + else + { + return RedirectToAction("ManageCompetencyAssessment", new { competencyAssessmentId }); } } @@ -323,11 +346,11 @@ public IActionResult EditBranding(EditBrandingViewModel model) model.CategorySelectList = categorySelectList; return View("EditBranding", model); } - if(model.BrandID == 0) + if (model.BrandID == 0) { model.BrandID = commonService.InsertBrandAndReturnId(model.Brand, (int)centreId); } - if(model.CategoryID == 0) + if (model.CategoryID == 0) { model.CategoryID = commonService.InsertCategoryAndReturnId(model.Category, (int)centreId); } diff --git a/DigitalLearningSolutions.Web/Services/CompetencyAssessmentService.cs b/DigitalLearningSolutions.Web/Services/CompetencyAssessmentService.cs index 3b19d98920..7e8cf37fdb 100644 --- a/DigitalLearningSolutions.Web/Services/CompetencyAssessmentService.cs +++ b/DigitalLearningSolutions.Web/Services/CompetencyAssessmentService.cs @@ -2,6 +2,7 @@ using DigitalLearningSolutions.Data.Models.Common; using DigitalLearningSolutions.Data.Models.CompetencyAssessments; using System.Collections.Generic; +using System.Threading.Tasks; namespace DigitalLearningSolutions.Web.Services { @@ -18,23 +19,24 @@ public interface ICompetencyAssessmentService CompetencyAssessment? GetCompetencyAssessmentById(int competencyAssessmentId, int adminId); IEnumerable GetNRPProfessionalGroups(); + IEnumerable GetNRPSubGroups(int? nRPProfessionalGroupID); + IEnumerable GetNRPRoles(int? nRPSubGroupID); CompetencyAssessmentTaskStatus GetCompetencyAssessmentTaskStatus(int assessmentId, int? frameworkId); //UPDATE DATA bool UpdateCompetencyAssessmentName(int competencyAssessmentId, int adminId, string competencyAssessmentName); - - bool UpdateCompetencyAssessmentProfessionalGroup(int competencyAssessmentId, int adminId, int? nrpProfessionalGroupID); + bool UpdateCompetencyRoleProfileLinks(int competencyAssessmentId, int adminId, int? professionalGroupId, int? subGroupId, int? roleId); bool UpdateIntroductoryTextTaskStatus(int assessmentId, bool taskStatus); bool UpdateCompetencyAssessmentDescription(int assessmentId, int adminId, string description); bool UpdateCompetencyAssessmentBranding(int assessmentId, int adminId, int brandID, int categoryID); bool UpdateBrandingTaskStatus(int assessmentId, bool taskStatus); bool UpdateCompetencyAssessmentVocabulary(int assessmentId, int adminId, string vocabulary); bool UpdateVocabularyTaskStatus(int assessmentId, bool taskStatus); + bool UpdateRoleProfileLinksTaskStatus(int assessmentId, bool taskStatus); //INSERT DATA int InsertCompetencyAssessment(int adminId, int centreId, string competencyAssessmentName, int? frameworkId); - } public class CompetencyAssessmentService : ICompetencyAssessmentService { @@ -91,9 +93,9 @@ public bool UpdateCompetencyAssessmentName(int competencyAssessmentId, int admin return competencyAssessmentDataService.UpdateCompetencyAssessmentName(competencyAssessmentId, adminId, competencyAssessmentName); } - public bool UpdateCompetencyAssessmentProfessionalGroup(int competencyAssessmentId, int adminId, int? nrpProfessionalGroupID) + public bool UpdateCompetencyRoleProfileLinks(int competencyAssessmentId, int adminId, int? professionalGroupId, int? subGroupId, int? roleId) { - return competencyAssessmentDataService.UpdateCompetencyAssessmentProfessionalGroup(competencyAssessmentId, adminId, nrpProfessionalGroupID); + return competencyAssessmentDataService.UpdateCompetencyRoleProfileLinks(competencyAssessmentId, adminId, professionalGroupId, subGroupId, roleId); } public CompetencyAssessmentTaskStatus GetCompetencyAssessmentTaskStatus(int assessmentId, int? frameworkId) { @@ -132,5 +134,20 @@ bool ICompetencyAssessmentService.UpdateVocabularyTaskStatus(int assessmentId, b { return competencyAssessmentDataService.UpdateVocabularyTaskStatus(assessmentId, taskStatus); } + + public IEnumerable GetNRPSubGroups(int? nRPProfessionalGroupID) + { + return competencyAssessmentDataService.GetNRPSubGroups(nRPProfessionalGroupID); + } + + public IEnumerable GetNRPRoles(int? nRPSubGroupID) + { + return competencyAssessmentDataService.GetNRPRoles(nRPSubGroupID); + } + + public bool UpdateRoleProfileLinksTaskStatus(int assessmentId, bool taskStatus) + { + return competencyAssessmentDataService.UpdateRoleProfileLinksTaskStatus(assessmentId, taskStatus); + } } } diff --git a/DigitalLearningSolutions.Web/ViewModels/CompetencyAssessments/EditRoleProfileLinksViewModel.cs b/DigitalLearningSolutions.Web/ViewModels/CompetencyAssessments/EditRoleProfileLinksViewModel.cs new file mode 100644 index 0000000000..54ddd177b5 --- /dev/null +++ b/DigitalLearningSolutions.Web/ViewModels/CompetencyAssessments/EditRoleProfileLinksViewModel.cs @@ -0,0 +1,43 @@ +namespace DigitalLearningSolutions.Web.ViewModels.CompetencyAssessments +{ + using DigitalLearningSolutions.Data.Models.CompetencyAssessments; + using Humanizer; + using System.Collections.Generic; + using System.Linq; + + public class EditRoleProfileLinksViewModel + { + public EditRoleProfileLinksViewModel() { } + public EditRoleProfileLinksViewModel(CompetencyAssessmentBase competencyAssessmentBase, IEnumerable professionalGroups, IEnumerable subGroups, IEnumerable roles, string actionName, bool? taskStatus) + { + ID = competencyAssessmentBase.ID; + CompetencyAssessmentName = competencyAssessmentBase.CompetencyAssessmentName; + ProfessionalGroupId = competencyAssessmentBase.NRPProfessionalGroupID; + SubGroupId = competencyAssessmentBase.NRPSubGroupID; + RoleId = competencyAssessmentBase.NRPRoleID; + UserRole = competencyAssessmentBase.UserRole; + TaskStatus = taskStatus; + ProfessionalGroups = professionalGroups; + SubGroups = subGroups; + Roles = roles; + ActionName = actionName; + RoleName = Roles.FirstOrDefault(r => r.ID == RoleId)?.ProfileName ?? "Don't link assessment to a role."; + SubGroupName = SubGroups.FirstOrDefault(s => s.ID == SubGroupId)?.SubGroup ?? "Don't link assessment to a sub group."; + GroupName = ProfessionalGroups.FirstOrDefault(p => p.ID == ProfessionalGroupId)?.ProfessionalGroup ?? "Don't link assessment to a professional group."; + } + public IEnumerable ProfessionalGroups { get; set; } + public IEnumerable SubGroups { get; set; } + public IEnumerable Roles { get; set; } + public int ID { get; set; } + public string CompetencyAssessmentName { get; set; } + public string ActionName { get; set; } + public int? ProfessionalGroupId { get; set; } + public int? SubGroupId { get; set; } + public int? RoleId { get; set; } + public int UserRole { get; set; } + public bool? TaskStatus { get; set; } + public string? GroupName { get; set; } + public string? SubGroupName { get; set; } + public string? RoleName { get; set; } + } +} diff --git a/DigitalLearningSolutions.Web/ViewModels/CompetencyAssessments/ProfessionalGroupViewModel.cs b/DigitalLearningSolutions.Web/ViewModels/CompetencyAssessments/ProfessionalGroupViewModel.cs deleted file mode 100644 index 86ba83228b..0000000000 --- a/DigitalLearningSolutions.Web/ViewModels/CompetencyAssessments/ProfessionalGroupViewModel.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace DigitalLearningSolutions.Web.ViewModels.CompetencyAssessments -{ - using DigitalLearningSolutions.Data.Models.CompetencyAssessments; - using System.Collections.Generic; - - public class ProfessionalGroupViewModel - { - public IEnumerable NRPProfessionalGroups { get; set; } - public CompetencyAssessmentBase CompetencyAssessmentBase { get; set; } - } -} diff --git a/DigitalLearningSolutions.Web/Views/CompetencyAssessments/EditRoleProfileLinks.cshtml b/DigitalLearningSolutions.Web/Views/CompetencyAssessments/EditRoleProfileLinks.cshtml new file mode 100644 index 0000000000..7a3d166cbb --- /dev/null +++ b/DigitalLearningSolutions.Web/Views/CompetencyAssessments/EditRoleProfileLinks.cshtml @@ -0,0 +1,256 @@ +@using DigitalLearningSolutions.Web.ViewModels.CompetencyAssessments; +@model EditRoleProfileLinksViewModel; +@{ + ViewData["Title"] = "Edit National Role Profile Links"; + ViewData["Application"] = "Framework Service"; +} + +@section NavMenuItems { + +} + +@section NavBreadcrumbs { + +} + +

Edit @Model.CompetencyAssessmentName national NHS role profile links

+@if (Model.TaskStatus != null | Model.ProfessionalGroupId != null) +{ +
+ +
+
+ Professional group +
+
+ @Model.GroupName +
+
+ + Change assessment name + +
+
+ @if (Model.ProfessionalGroupId != null && Model.ActionName != "EditSubGroup") + { +
+
+ Sub group +
+
+ @Model.SubGroupName +
+
+ + Change assessment name + +
+
+ } + @if (Model.SubGroupId != null && Model.ActionName != "EditRole") + { +
+
+ Role +
+
+ @Model.RoleName +
+
+ + Change assessment name + +
+
+ } +
+} +@if (Model.ActionName == "EditGroup") +{ +
+ @if (!ViewData.ModelState.IsValid) + { + + } + +
+ +

+ Choose the NHS national role profile professional group to associate with this assessment. +

+
+ +
+ @foreach (var professionalGroup in Model.ProfessionalGroups) + { +
+ + +
+ } +
+ +
+ + +
+
+
+
+ + + + + + + + + + + + +} +else if (Model.ActionName == "EditSubGroup" && Model.ProfessionalGroupId != null) +{ +
+ @if (!ViewData.ModelState.IsValid) + { + + } + +
+ +

+ Choose the role sub group to associate with this assessment. +

+
+ +
+ @foreach (var subGroup in Model.SubGroups) + { +
+ + +
+ } +
+ +
+ + +
+
+
+
+ + + + + + + + + + + +} +else if (Model.ActionName == "EditRole" && Model.SubGroupId != null) +{ +
+ @if (!ViewData.ModelState.IsValid) + { + + } + +
+ +

+ Choose the role to associate with this assessment. +

+
+ +
+ @foreach (var role in Model.Roles) + { +
+ + +
+ } +
+ +
+ + +
+
+
+
+ + + + + + + + + + + +} +else if (Model.ActionName == "Summary") +{ +
+ + + + + + + + + + + + + + +
+} + diff --git a/DigitalLearningSolutions.Web/Views/CompetencyAssessments/ManageCompetencyAssessment.cshtml b/DigitalLearningSolutions.Web/Views/CompetencyAssessments/ManageCompetencyAssessment.cshtml index 92a8691086..3e4f9f34be 100644 --- a/DigitalLearningSolutions.Web/Views/CompetencyAssessments/ManageCompetencyAssessment.cshtml +++ b/DigitalLearningSolutions.Web/Views/CompetencyAssessments/ManageCompetencyAssessment.cshtml @@ -107,7 +107,7 @@
  • CMS manager
  • "); returnedEmail.Body.TextBody.Should().NotContain("CMS manager"); } + if (!string.IsNullOrEmpty(categoryName)) + { + returnedEmail.Body.HtmlBody.Should().Contain("In the Digital Workplace category."); + returnedEmail.Body.TextBody.Should().Contain("In the Digital Workplace category."); + } returnedEmail.Body.HtmlBody.Should().Contain("the next time you log in to " + centreName + "."); returnedEmail.Body.TextBody.Should().Contain("the next time you log in to " + centreName + "."); diff --git a/DigitalLearningSolutions.Web/Controllers/LearningPortalController/SelfAssessment.cs b/DigitalLearningSolutions.Web/Controllers/LearningPortalController/SelfAssessment.cs index 2234f7d9eb..4947c6bd75 100644 --- a/DigitalLearningSolutions.Web/Controllers/LearningPortalController/SelfAssessment.cs +++ b/DigitalLearningSolutions.Web/Controllers/LearningPortalController/SelfAssessment.cs @@ -1565,7 +1565,18 @@ ManageOptionalCompetenciesViewModel model } } - + + if (!selfAssessmentService.HasMinimumOptionalCompetencies(selfAssessmentId, delegateUserId)) + { + var supervisorsSignOffs = selfAssessmentService.GetSupervisorSignOffsForCandidateAssessment(selfAssessmentId, delegateUserId); + + if (supervisorsSignOffs.FirstOrDefault() is { Verified: null, Removed: null }) + { + selfAssessmentService.RemoveSignoffRequestById(supervisorsSignOffs.FirstOrDefault().ID); + } + } + + return RedirectToAction("SelfAssessmentOverview", new { selfAssessmentId, vocabulary }); } @@ -1577,9 +1588,9 @@ public IActionResult RequestSignOff(int selfAssessmentId) var delegateId = User.GetCandidateIdKnownNotNull(); var recentResults = selfAssessmentService.GetMostRecentResults(selfAssessmentId, delegateId).ToList(); var competencySummaries = CertificateHelper.CompetencySummation(recentResults); - - if (competencySummaries.QuestionsCount != competencySummaries.VerifiedCount) return RedirectToAction("StatusCode", "LearningSolutions", new { code = 403 }); - + + if (competencySummaries.QuestionsCount != competencySummaries.VerifiedCount) return RedirectToAction("StatusCode", "LearningSolutions", new { code = 403 }); + var assessment = selfAssessmentService.GetSelfAssessmentForCandidateById(delegateUserId, selfAssessmentId); var supervisors = selfAssessmentService.GetSignOffSupervisorsForSelfAssessmentId(selfAssessmentId, delegateUserId); @@ -1591,7 +1602,7 @@ public IActionResult RequestSignOff(int selfAssessmentId) NumberOfSelfAssessedOptionalCompetencies = optionalCompetencies.Count(x => x.IncludedInSelfAssessment) }; if (model.NumberOfSelfAssessedOptionalCompetencies < model.SelfAssessment.MinimumOptionalCompetencies) return RedirectToAction("StatusCode", "LearningSolutions", new { code = 403 }); - + return View("SelfAssessments/RequestSignOff", model); } diff --git a/DigitalLearningSolutions.Web/Controllers/SupervisorController/Supervisor.cs b/DigitalLearningSolutions.Web/Controllers/SupervisorController/Supervisor.cs index 93c8e1f610..21b555391c 100644 --- a/DigitalLearningSolutions.Web/Controllers/SupervisorController/Supervisor.cs +++ b/DigitalLearningSolutions.Web/Controllers/SupervisorController/Supervisor.cs @@ -1061,8 +1061,8 @@ public IActionResult QuickAddSupervisor(int selfAssessmentId, int supervisorDele var sessionEnrolOnCompetencyAssessment = new SessionEnrolOnCompetencyAssessment() { - SelfAssessmentID = supervisorRoles.FirstOrDefault().SelfAssessmentID, - SelfAssessmentSupervisorRoleId = supervisorRoles.FirstOrDefault().ID + SelfAssessmentID = supervisorRoles.FirstOrDefault() != null ? supervisorRoles.FirstOrDefault().SelfAssessmentID : selfAssessmentId, + SelfAssessmentSupervisorRoleId = supervisorRoles.FirstOrDefault() != null ? supervisorRoles.FirstOrDefault().ID : 0 }; multiPageFormService.SetMultiPageFormData( @@ -1070,7 +1070,7 @@ public IActionResult QuickAddSupervisor(int selfAssessmentId, int supervisorDele MultiPageFormDataFeature.EnrolDelegateOnProfileAssessment, TempData ); - var supervisorRoleName = supervisorRoles.FirstOrDefault().RoleName; + var supervisorRoleName = supervisorRoles.FirstOrDefault() != null ? supervisorRoles.FirstOrDefault().RoleName : ""; var model = new EnrolDelegateSummaryViewModel { CompetencyAssessment = competencyAssessment, @@ -1328,6 +1328,9 @@ public IActionResult ConfirmNominateSupervisor(SupervisorDelegateViewModel super { registrationService.PromoteDelegateToAdmin(adminRoles, supervisorDelegate.SelfAssessmentCategory, (int)supervisorDelegateDetail.DelegateUserID, (int)User.GetCentreId(), true); + int? learningCategory = supervisorDelegate.SelfAssessmentCategory == 0 ? null : supervisorDelegate.SelfAssessmentCategory; + var learningCategoryName = courseCategoriesService.GetCourseCategoryName(learningCategory); + if (delegateUser != null && adminUser != null) { var adminRolesEmail = emailGenerationService.GenerateDelegateAdminRolesNotificationEmail( @@ -1344,7 +1347,8 @@ public IActionResult ConfirmNominateSupervisor(SupervisorDelegateViewModel super isCmsAdmin: adminRoles.IsCmsAdministrator, isCmsManager: adminRoles.IsCmsManager, primaryEmail: delegateUser.EmailAddress, - centreName: centreName + centreName: centreName, + learningCategoryName ); emailService.SendEmail(adminRolesEmail); diff --git a/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/Administrator/AdministratorController.cs b/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/Administrator/AdministratorController.cs index 317eec01ad..57fa350f35 100644 --- a/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/Administrator/AdministratorController.cs +++ b/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/Administrator/AdministratorController.cs @@ -177,8 +177,10 @@ public IActionResult EditAdminRoles(AdminRolesFormData model, int adminId) adminRoles, AdminCategoryHelper.AdminCategoryToCategoryId(model.LearningCategory) ); + int? learningCategory = model.LearningCategory == 0 ? null : model.LearningCategory; + var learningCategoryName = courseCategoriesService.GetCourseCategoryName(learningCategory); - SendNotificationEmail(adminId, adminRoles); + SendNotificationEmail(adminId, adminRoles, learningCategoryName); return RedirectToAction( "Index", @@ -190,7 +192,8 @@ public IActionResult EditAdminRoles(AdminRolesFormData model, int adminId) private void SendNotificationEmail( int adminIdToPromote, - AdminRoles adminRoles + AdminRoles adminRoles, + string learningCategoryName ) { var adminId = User.GetAdminId(); @@ -215,7 +218,8 @@ AdminRoles adminRoles isCmsAdmin: adminRoles.IsCmsAdministrator, isCmsManager: adminRoles.IsCmsManager, primaryEmail: delegateUserEmailDetails.EmailAddress, - centreName: centreName + centreName: centreName, + learningCategoryName ); emailService.SendEmail(adminRolesEmail); diff --git a/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/SelfAssessmentReports/SelfAssessmentReportsController.cs b/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/SelfAssessmentReports/SelfAssessmentReportsController.cs index 7af1d2f4ca..0491429fd3 100644 --- a/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/SelfAssessmentReports/SelfAssessmentReportsController.cs +++ b/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/SelfAssessmentReports/SelfAssessmentReportsController.cs @@ -8,11 +8,9 @@ using DigitalLearningSolutions.Web.Attributes; using DigitalLearningSolutions.Web.Models.Enums; using DigitalLearningSolutions.Data.Enums; - using System; using DigitalLearningSolutions.Data.Utilities; using DigitalLearningSolutions.Web.ViewModels.TrackingSystem.Centre.Reports; using DigitalLearningSolutions.Web.Helpers.ExternalApis; - using System.Threading.Tasks; using Microsoft.Extensions.Configuration; using DigitalLearningSolutions.Data.Extensions; using DigitalLearningSolutions.Web.Services; @@ -75,8 +73,9 @@ public IActionResult DownloadDigitalCapabilityToExcel() public IActionResult DownloadSelfAssessmentReport(int selfAssessmentId) { var centreId = User.GetCentreId(); + var selfAssessmentName = selfAssessmentService.GetSelfAssessmentNameById(selfAssessmentId); var dataFile = selfAssessmentReportService.GetSelfAssessmentExcelExportForCentre((int)centreId, selfAssessmentId); - var fileName = $"Competency Self Assessment Report - Centre {centreId} - downloaded {DateTime.Today:yyyy-MM-dd}.xlsx"; + var fileName = $"{((selfAssessmentName.Length > 50) ? selfAssessmentName.Substring(0, 50) : selfAssessmentName)} Report - Centre {centreId} - downloaded {clockUtility.UtcNow:yyyy-MM-dd}.xlsx"; return File( dataFile, FileHelper.GetContentTypeFromFileName(fileName), diff --git a/DigitalLearningSolutions.Web/Controllers/TrackingSystem/CourseSetup/CourseSetupController.cs b/DigitalLearningSolutions.Web/Controllers/TrackingSystem/CourseSetup/CourseSetupController.cs index 775e52ecdb..93eb9dc09e 100644 --- a/DigitalLearningSolutions.Web/Controllers/TrackingSystem/CourseSetup/CourseSetupController.cs +++ b/DigitalLearningSolutions.Web/Controllers/TrackingSystem/CourseSetup/CourseSetupController.cs @@ -365,7 +365,8 @@ public IActionResult SetCourseOptions(EditCourseOptionsFormData model) data!.CourseOptionsData = model.ToCourseOptionsTempData(); multiPageFormService.SetMultiPageFormData(data, MultiPageFormDataFeature.AddNewCourse, TempData); - return RedirectToAction("SetCourseContent", false); + bool editCourseContent = data?.EditCourseContent ?? false; + return RedirectToAction("SetCourseContent", editCourseContent); } [HttpGet("AddCourse/SetCourseContent")] @@ -381,7 +382,7 @@ public IActionResult SetCourseContent(bool editCourseContent) { return RedirectToAction("Summary"); } - data.EditCourseContent = editCourseContent; + data.EditCourseContent = data.EditCourseContent || editCourseContent; multiPageFormService.SetMultiPageFormData(data, MultiPageFormDataFeature.AddNewCourse, TempData); var model = data!.CourseContentData != null @@ -459,17 +460,15 @@ public IActionResult SetSectionContent(int sectionIndex) } var showDiagnostic = data.Application!.DiagAssess; - if (data.EditCourseContent) + var tutorial = GetTutorialsFromSectionContentData(data.SectionContentData, tutorials); + if (tutorial.Count() == 0) { - var tutorial = GetTutorialsFromSectionContentData(data.SectionContentData, tutorials); - var model = new SetSectionContentViewModel(section, sectionIndex, showDiagnostic, tutorial); - return View("AddNewCentreCourse/SetSectionContent", model); - } - else - { - var model = new SetSectionContentViewModel(section, sectionIndex, showDiagnostic, tutorials); - return View("AddNewCentreCourse/SetSectionContent", model); + var models = new SetSectionContentViewModel(section, sectionIndex, showDiagnostic, tutorials); + return View("AddNewCentreCourse/SetSectionContent", models); } + var model = new SetSectionContentViewModel(section, sectionIndex, showDiagnostic, tutorial); + return View("AddNewCentreCourse/SetSectionContent", model); + } @@ -500,6 +499,21 @@ string action public IActionResult Summary() { var data = multiPageFormService.GetMultiPageFormData(MultiPageFormDataFeature.AddNewCourse, TempData).GetAwaiter().GetResult(); + var updatedSections = new List(); + foreach (var item in data.CourseContentData.SelectedSectionIds) + { + var tutorialsForSection = tutorialService.GetTutorialsForSection(item).ToList(); + + var matchingSections = data.SectionContentData + .Where(section => section.Tutorials.Any(t => tutorialsForSection.Any(tf => tf.TutorialId == t.TutorialId))) + .ToList(); + + updatedSections.AddRange(matchingSections); + } + + updatedSections = updatedSections.Distinct().ToList(); + data.SectionContentData = updatedSections; + multiPageFormService.SetMultiPageFormData(data, MultiPageFormDataFeature.AddNewCourse, TempData); var model = new SummaryViewModel(data!); @@ -651,11 +665,23 @@ private IActionResult SaveSectionAndRedirect(SetSectionContentViewModel model) { data.SectionContentData = new List(); } - if (data.EditCourseContent) + var sectionsToRemove = new List(); + foreach (var section in data.SectionContentData) { - return RedirectToNextSectionOrSummary( - model.Index, - new SetCourseContentViewModel(data.CourseContentData!)); + section.Tutorials = section.Tutorials + .Where(t => !model.Tutorials.Any(newT => newT.TutorialId == t.TutorialId)) + .ToList(); + if (!section.Tutorials.Any()) + { + sectionsToRemove.Add(section); + } + } + if (sectionsToRemove.Count > 0) + { + foreach (var section in sectionsToRemove) + { + data.SectionContentData.Remove(section); + } } data!.SectionContentData!.Add( new SectionContentTempData( @@ -732,18 +758,19 @@ private static IEnumerable UpdateC private IEnumerable GetTutorialsFromSectionContentData(List sectionContentData, List sectionTutorial) { if (sectionContentData == null || sectionTutorial == null) return new List(); - var updatedRecords = sectionContentData - .SelectMany(data => data.Tutorials) - .Join(sectionTutorial, - tempData => new { tempData.TutorialId, tempData.TutorialName }, // Match on both TutorialId and TutorialName - index => new { index.TutorialId, index.TutorialName }, - (tempData, index) => new Tutorial + var updatedRecords = sectionTutorial + .GroupJoin( + sectionContentData.SelectMany(data => data.Tutorials), + tutorial => new { tutorial.TutorialId, tutorial.TutorialName }, + tempData => new { tempData.TutorialId, tempData.TutorialName }, + (tutorial, matchingTempData) => new Tutorial { - TutorialId = index.TutorialId, - TutorialName = index.TutorialName, - Status = tempData.LearningEnabled, // Updated from sectionContentData - DiagStatus = tempData.DiagnosticEnabled // Updated from sectionContentData - }) + TutorialId = tutorial.TutorialId, + TutorialName = tutorial.TutorialName, + Status = matchingTempData.Any() ? matchingTempData.First().LearningEnabled : tutorial.Status, + DiagStatus = matchingTempData.Any() ? matchingTempData.First().DiagnosticEnabled : tutorial.DiagStatus + } + ) .ToList(); return updatedRecords; diff --git a/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Delegates/PromoteToAdminController.cs b/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Delegates/PromoteToAdminController.cs index c579516102..21d02d0ef5 100644 --- a/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Delegates/PromoteToAdminController.cs +++ b/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Delegates/PromoteToAdminController.cs @@ -139,6 +139,9 @@ public IActionResult Index(AdminRolesFormData formData, int delegateId) var delegateUserEmailDetails = userService.GetDelegateById(delegateId); + int? learningCategory = formData.LearningCategory == 0 ? null : formData.LearningCategory; + var learningCategoryName = courseCategoriesService.GetCourseCategoryName(learningCategory); + if (delegateUserEmailDetails != null) { var adminRolesEmail = emailGenerationService.GenerateDelegateAdminRolesNotificationEmail( @@ -155,7 +158,8 @@ public IActionResult Index(AdminRolesFormData formData, int delegateId) isCmsAdmin: adminRoles.IsCmsAdministrator, isCmsManager: adminRoles.IsCmsManager, primaryEmail: delegateUserEmailDetails.EmailForCentreNotifications, - centreName: centreName + centreName: centreName, + categoryName: learningCategoryName ); emailService.SendEmail(adminRolesEmail); diff --git a/DigitalLearningSolutions.Web/Services/CourseCategoriesService.cs b/DigitalLearningSolutions.Web/Services/CourseCategoriesService.cs index fc136f598e..9b475e9286 100644 --- a/DigitalLearningSolutions.Web/Services/CourseCategoriesService.cs +++ b/DigitalLearningSolutions.Web/Services/CourseCategoriesService.cs @@ -7,7 +7,7 @@ namespace DigitalLearningSolutions.Web.Services public interface ICourseCategoriesService { IEnumerable GetCategoriesForCentreAndCentrallyManagedCourses(int centreId); - string? GetCourseCategoryName(int categoryId); + string? GetCourseCategoryName(int? categoryId); } public class CourseCategoriesService : ICourseCategoriesService { @@ -22,7 +22,7 @@ public IEnumerable GetCategoriesForCentreAndCentrallyManagedCourses(in return courseCategoriesDataService.GetCategoriesForCentreAndCentrallyManagedCourses(centreId); } - public string? GetCourseCategoryName(int categoryId) + public string? GetCourseCategoryName(int? categoryId) { return courseCategoriesDataService.GetCourseCategoryName(categoryId); } diff --git a/DigitalLearningSolutions.Web/Services/EmailGenerationService.cs b/DigitalLearningSolutions.Web/Services/EmailGenerationService.cs index b631d48adc..ff7a924f82 100644 --- a/DigitalLearningSolutions.Web/Services/EmailGenerationService.cs +++ b/DigitalLearningSolutions.Web/Services/EmailGenerationService.cs @@ -19,7 +19,8 @@ Email GenerateDelegateAdminRolesNotificationEmail( bool isCmsAdmin, bool isCmsManager, string primaryEmail, - string centreName + string centreName, + string categoryName ); } @@ -39,7 +40,8 @@ public Email GenerateDelegateAdminRolesNotificationEmail( bool isCmsAdmin, bool isCmsManager, string primaryEmail, - string centreName + string centreName, + string categoryName ) { const string emailSubjectLine = "New Digital Learning Solutions permissions granted"; @@ -101,6 +103,13 @@ string centreName builder.HtmlBody += ""; + if (!string.IsNullOrEmpty(categoryName)) + { + builder.TextBody += $@"In the {categoryName} category."; + builder.HtmlBody += $@" +

    In the {categoryName} category.

    "; + } + builder.TextBody += $@"You will be able to access the Digital Learning Solutions platform with these new access permissions the next time you log in to {centreName}."; builder.HtmlBody += $@"You will be able to access the Digital Learning Solutions platform with these new access permissions the next time you log in to {centreName}."; diff --git a/DigitalLearningSolutions.Web/Services/SelfAssessmentService.cs b/DigitalLearningSolutions.Web/Services/SelfAssessmentService.cs index ce7afea305..c9a50014fa 100644 --- a/DigitalLearningSolutions.Web/Services/SelfAssessmentService.cs +++ b/DigitalLearningSolutions.Web/Services/SelfAssessmentService.cs @@ -27,6 +27,7 @@ public interface ISelfAssessmentService void UpdateLastAccessed(int selfAssessmentId, int delegateUserId); void RemoveSignoffRequests(int selfAssessmentId, int delegateUserId, int competencyGroupsId); + void RemoveSignoffRequestById(int candidateAssessmentSupervisorVerificationsId); void IncrementLaunchCount(int selfAssessmentId, int delegateUserId); void SetCompleteByDate(int selfAssessmentId, int delegateUserId, DateTime? completeByDate); @@ -160,7 +161,7 @@ public IEnumerable GetSelfAssessmentResultswithSupervisorV int selfAssessmentId, int competencyId ); - void RemoveReviewCandidateAssessmentOptionalCompetencies(int id); + void RemoveReviewCandidateAssessmentOptionalCompetencies(int id); } public class SelfAssessmentService : ISelfAssessmentService @@ -201,6 +202,10 @@ public void RemoveSignoffRequests(int selfAssessmentId, int delegateUserId, int { selfAssessmentDataService.RemoveSignoffRequests(selfAssessmentId, delegateUserId, competencyGroupId); } + public void RemoveSignoffRequestById(int candidateAssessmentSupervisorVerificationsId) + { + selfAssessmentDataService.RemoveSignoffRequestById(candidateAssessmentSupervisorVerificationsId); + } public void IncrementLaunchCount(int selfAssessmentId, int delegateUserId) { selfAssessmentDataService.IncrementLaunchCount(selfAssessmentId, delegateUserId); @@ -467,10 +472,10 @@ public void RemoveEnrolment(int selfAssessmentId, int delegateUserId) var selfAssessmentCategoryId = selfAssessmentDataService.GetSelfAssessmentCategoryId((int)selfAssessmentId); - if (adminCategoryId > 0 && adminCategoryId != selfAssessmentCategoryId) + if (adminCategoryId > 0 && adminCategoryId != selfAssessmentCategoryId) { // return null variants of the object when the categoryID mismatches - return (new SelfAssessmentDelegatesData(), null); + return (new SelfAssessmentDelegatesData(), null); } (var delegateselfAssessments, int resultCount) = selfAssessmentDataService.GetSelfAssessmentDelegates(searchString, offSet, itemsPerPage, sortBy, sortDirection, @@ -603,7 +608,7 @@ int competencyId } public void RemoveReviewCandidateAssessmentOptionalCompetencies(int id) { - selfAssessmentDataService.RemoveReviewCandidateAssessmentOptionalCompetencies(id); + selfAssessmentDataService.RemoveReviewCandidateAssessmentOptionalCompetencies(id); } } } diff --git a/DigitalLearningSolutions.Web/ViewModels/Supervisor/EnrolDelegateSummaryViewModel.cs b/DigitalLearningSolutions.Web/ViewModels/Supervisor/EnrolDelegateSummaryViewModel.cs index 681213e53f..ad66e71ac8 100644 --- a/DigitalLearningSolutions.Web/ViewModels/Supervisor/EnrolDelegateSummaryViewModel.cs +++ b/DigitalLearningSolutions.Web/ViewModels/Supervisor/EnrolDelegateSummaryViewModel.cs @@ -12,5 +12,6 @@ public class EnrolDelegateSummaryViewModel public string SupervisorRoleName { get; set; } public int SupervisorRoleCount { get; set; } public bool AllowSupervisorRoleSelection { get; set; } + public bool HasSupervisorRoles => !string.IsNullOrWhiteSpace(SupervisorRoleName); } } diff --git a/DigitalLearningSolutions.Web/ViewModels/Supervisor/ReviewSelfAssessmentViewModel.cs b/DigitalLearningSolutions.Web/ViewModels/Supervisor/ReviewSelfAssessmentViewModel.cs index ea19f92d35..9a6463e28f 100644 --- a/DigitalLearningSolutions.Web/ViewModels/Supervisor/ReviewSelfAssessmentViewModel.cs +++ b/DigitalLearningSolutions.Web/ViewModels/Supervisor/ReviewSelfAssessmentViewModel.cs @@ -1,6 +1,5 @@ namespace DigitalLearningSolutions.Web.ViewModels.Supervisor { - using DigitalLearningSolutions.Data.Models.Frameworks; using DigitalLearningSolutions.Data.Models.SelfAssessments; using DigitalLearningSolutions.Data.Models.Supervisor; using DigitalLearningSolutions.Web.Helpers; @@ -15,9 +14,9 @@ public class ReviewSelfAssessmentViewModel public IEnumerable? SupervisorSignOffs { get; set; } public bool IsSupervisorResultsReviewed { get; set; } public SearchSupervisorCompetencyViewModel SearchViewModel { get; set; } - public string VocabPlural(string vocabulary) + public string VocabPlural() { - return FrameworkVocabularyHelper.VocabularyPlural(vocabulary); + return FrameworkVocabularyHelper.VocabularyPlural(DelegateSelfAssessment.Vocabulary); } public int CandidateAssessmentId { get; set; } public bool ExportToExcelHide { get; set; } diff --git a/DigitalLearningSolutions.Web/Views/Supervisor/ReviewSelfAssessment.cshtml b/DigitalLearningSolutions.Web/Views/Supervisor/ReviewSelfAssessment.cshtml index fe90d8a161..38913441d2 100644 --- a/DigitalLearningSolutions.Web/Views/Supervisor/ReviewSelfAssessment.cshtml +++ b/DigitalLearningSolutions.Web/Views/Supervisor/ReviewSelfAssessment.cshtml @@ -96,7 +96,7 @@ } - @if(Model.CompetencySummaries.CanViewCertificate) + @if (Model.CompetencySummaries.CanViewCertificate) { } - @if(Model.DelegateSelfAssessment.SignOffRequested > 0 && Model.CompetencySummaries.VerifiedCount == Model.CompetencySummaries.QuestionsCount) + @if (Model.DelegateSelfAssessment.SignOffRequested > 0 && Model.CompetencySummaries.VerifiedCount == Model.CompetencySummaries.QuestionsCount) { Sign-off self assessment } - @if((Model.DelegateSelfAssessment.ResultsVerificationRequests > 1) && Model.CompetencySummaries.VerifiedCount < Model.CompetencySummaries.QuestionsCount) + @if ((Model.DelegateSelfAssessment.ResultsVerificationRequests > 1) && Model.CompetencySummaries.VerifiedCount < Model.CompetencySummaries.QuestionsCount) { Confirm multiple results } @@ -119,6 +119,7 @@ +

    @Model.CompetencyGroups.Sum(g => g.Count()) matching @Model.VocabPlural().ToLower()

    @if (Model.CompetencyGroups.Any()) { foreach (var competencyGroup in Model.CompetencyGroups) diff --git a/DigitalLearningSolutions.Web/Views/Supervisor/SelectDelegateSupervisorRoleSummary.cshtml b/DigitalLearningSolutions.Web/Views/Supervisor/SelectDelegateSupervisorRoleSummary.cshtml index aee6d861fd..9c96e6b6d3 100644 --- a/DigitalLearningSolutions.Web/Views/Supervisor/SelectDelegateSupervisorRoleSummary.cshtml +++ b/DigitalLearningSolutions.Web/Views/Supervisor/SelectDelegateSupervisorRoleSummary.cshtml @@ -47,7 +47,15 @@ -

    Supervision Summary

    +@if (!Model.Item1.HasSupervisorRoles) +{ +

    No supervisor roles have been configured for this self assessment.

    +} +else +{ + + +

    Supervision Summary

    @@ -115,3 +123,4 @@ Cancel
    +} diff --git a/DigitalLearningSolutions.Web/Views/Supervisor/VerifyMultipleResults.cshtml b/DigitalLearningSolutions.Web/Views/Supervisor/VerifyMultipleResults.cshtml index 5857981d50..97dc08a7fa 100644 --- a/DigitalLearningSolutions.Web/Views/Supervisor/VerifyMultipleResults.cshtml +++ b/DigitalLearningSolutions.Web/Views/Supervisor/VerifyMultipleResults.cshtml @@ -1,56 +1,56 @@ @using DigitalLearningSolutions.Web.ViewModels.Supervisor; @model ReviewSelfAssessmentViewModel; @{ - ViewData["Title"] = "Review Self Assessment"; - ViewData["Application"] = "Supervisor"; - ViewData["HeaderPathName"] = "Supervisor"; + ViewData["Title"] = "Review Self Assessment"; + ViewData["Application"] = "Supervisor"; + ViewData["HeaderPathName"] = "Supervisor"; } @section NavMenuItems { - + } - @section NavBreadcrumbs { - +@section NavBreadcrumbs { + } @{ var errorHasOccurred = !ViewData.ModelState.IsValid; @@ -72,92 +72,92 @@ } -
    +
    -

    - @Model.SupervisorDelegateDetail.FirstName @Model.SupervisorDelegateDetail.LastName -

    +

    + @Model.SupervisorDelegateDetail.FirstName @Model.SupervisorDelegateDetail.LastName +

    - +
    -
    -

    Confirm Multiple Results for @Model.DelegateSelfAssessment.RoleName

    - @if (Model.CompetencyGroups.Any()) +
    +

    Confirm Multiple Results for @Model.DelegateSelfAssessment.RoleName

    +@if (Model.CompetencyGroups.Any()) { -

    Tick each self assessment result that you wish to confirm and then click Submit

    -
    - @foreach (var competencyGroup in Model.CompetencyGroups) - { - var vocabulary = competencyGroup.First().Vocabulary; -
    - - - @competencyGroup.Key - - -
    - @if (competencyGroup.Count() > 1) - { - - } - - - - - - - - - - @foreach (var competency in competencyGroup) - { - @foreach (var question in competency.AssessmentQuestions) +

    Tick each self assessment result that you wish to confirm and then click Submit

    + + @foreach (var competencyGroup in Model.CompetencyGroups) + { + var vocabulary = competencyGroup.First().Vocabulary; +
    + + + @competencyGroup.Key + + +
    + @if (competencyGroup.Count() > 1) { - - - - + } - } - -
    - @vocabulary - - Question - - Response -
    - @competency.Vocabulary -
    - - -
    -
    - } -
    -
    - - Cancel -
    -
    -
    + + + + + + + + + + @foreach (var competency in competencyGroup) + { + @foreach (var question in competency.AssessmentQuestions) + { + + + + + } + } + +
    + @vocabulary + + Question + + Response +
    + @competency.Vocabulary +
    + + +
    +
    + } +
    +
    + + Cancel +
    +
    + } else { -

    - Oops. There are no results awaiting confirmation. -

    - Cancel +

    + Oops. There are no results awaiting confirmation. +

    + Cancel } @section scripts { - + } diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/CourseSetup/AddNewCentreCourse/SetSectionContent.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/CourseSetup/AddNewCentreCourse/SetSectionContent.cshtml index 24a7adb46f..df199588b8 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/CourseSetup/AddNewCentreCourse/SetSectionContent.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/CourseSetup/AddNewCentreCourse/SetSectionContent.cshtml @@ -3,34 +3,37 @@ @model SetSectionContentViewModel @{ - ViewData["Title"] = "Set section content"; - var backLinkRouteData = new Dictionary { { "index", Model.Index.ToString() } }; + ViewData["Title"] = "Set section content"; + var sectionIndex = Model.Index == 0 ? Model.Index : Model.Index - 1; + var backLinkRouteData = new Dictionary { { "index", Model.Index.ToString() } }; }
    -
    -

    @ViewData["Title"]

    +
    +

    @ViewData["Title"]

    - + -
    - + + - + - - - @if (Model.Index == 0) - { - - } - else - { - - } -
    + + + @if (Model.Index == 0) + { + + } + else + { + + < Go back + + } +
    @section scripts { - + } From 36d1cd873e0e80aa56389853325f64b0180a2315 Mon Sep 17 00:00:00 2001 From: kevwhitt-hee Date: Wed, 5 Mar 2025 08:27:09 +0000 Subject: [PATCH 3/3] Fixes link visually hidden text and summary item display logic --- .../CompetencyAssessments.cs | 4 ++-- .../EditRoleProfileLinks.cshtml | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/DigitalLearningSolutions.Web/Controllers/CompetencyAssessmentsController/CompetencyAssessments.cs b/DigitalLearningSolutions.Web/Controllers/CompetencyAssessmentsController/CompetencyAssessments.cs index 855a123e4a..aee8442d14 100644 --- a/DigitalLearningSolutions.Web/Controllers/CompetencyAssessmentsController/CompetencyAssessments.cs +++ b/DigitalLearningSolutions.Web/Controllers/CompetencyAssessmentsController/CompetencyAssessments.cs @@ -247,7 +247,7 @@ public IActionResult EditRoleProfileLinks(EditRoleProfileLinksViewModel model, s var isUpdated = competencyAssessmentService.UpdateCompetencyRoleProfileLinks(model.ID, adminId, model.ProfessionalGroupId, model.SubGroupId, model.RoleId); if (model.ActionName == "EditGroup") { - if(model.ProfessionalGroupId == null) + if (model.ProfessionalGroupId == null) { return RedirectToAction("EditRoleProfileLinks", new { actionName = "Summary", competencyAssessmentId }); } @@ -269,7 +269,7 @@ public IActionResult EditRoleProfileLinks(EditRoleProfileLinksViewModel model, s } else if (model.ActionName == "EditRole") { - return RedirectToAction("EditRoleProfileLinks", new { actionName = "Summary", competencyAssessmentId }); + return RedirectToAction("EditRoleProfileLinks", new { actionName = "Summary", competencyAssessmentId }); } else { diff --git a/DigitalLearningSolutions.Web/Views/CompetencyAssessments/EditRoleProfileLinks.cshtml b/DigitalLearningSolutions.Web/Views/CompetencyAssessments/EditRoleProfileLinks.cshtml index 7a3d166cbb..b5faad6214 100644 --- a/DigitalLearningSolutions.Web/Views/CompetencyAssessments/EditRoleProfileLinks.cshtml +++ b/DigitalLearningSolutions.Web/Views/CompetencyAssessments/EditRoleProfileLinks.cshtml @@ -6,7 +6,7 @@ } @section NavMenuItems { - + } @section NavBreadcrumbs { @@ -23,9 +23,9 @@ }

    Edit @Model.CompetencyAssessmentName national NHS role profile links

    -@if (Model.TaskStatus != null | Model.ProfessionalGroupId != null) +@if (Model.TaskStatus != null | Model.ActionName != "EditGroup") { -
    +
    @@ -51,12 +51,12 @@
    - Change assessment name + Change sub group link
    } - @if (Model.SubGroupId != null && Model.ActionName != "EditRole") + @if (Model.SubGroupId != null && Model.ActionName == "Summary") { @@ -244,7 +244,7 @@ else if (Model.ActionName == "Summary") - + }