Skip to content

Commit d836e4b

Browse files
authored
Merge pull request #2946 from TechnologyEnhancedLearning/Develop/Fix/TD-4327-Confirmation-link-other-centres-Issue
TD-4327-Supervisor delegate validation added
2 parents 5cbd72f + 4210c3a commit d836e4b

File tree

1 file changed

+5
-4
lines changed
  • DigitalLearningSolutions.Web/Controllers/SupervisorController

1 file changed

+5
-4
lines changed

DigitalLearningSolutions.Web/Controllers/SupervisorController/Supervisor.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public IActionResult MyStaffList(
5858
var centreId = GetCentreId();
5959
var supervisorEmail = GetUserEmail();
6060
var loggedInAdminUser = userService.GetAdminUserById(adminId);
61-
var centreRegistrationPrompts = centreRegistrationPromptsService.GetCentreRegistrationPromptsByCentreId(centreId);
61+
var centreRegistrationPrompts = centreRegistrationPromptsService.GetCentreRegistrationPromptsByCentreId(centreId);
6262
var supervisorDelegateDetails = supervisorService.GetSupervisorDelegateDetailsForAdminId(adminId, loggedInAdminUser.CategoryId);
6363
if (!supervisorDelegateDetails.Any())
6464
{
@@ -343,7 +343,7 @@ public IActionResult AllStaffList()
343343
var loggedInUserId = User.GetUserId();
344344
var loggedInAdminUser = userService.GetAdminUserById(adminId);
345345
var centreCustomPrompts = centreRegistrationPromptsService.GetCentreRegistrationPromptsByCentreId(centreId);
346-
var supervisorDelegateDetails = supervisorService.GetSupervisorDelegateDetailsForAdminId(adminId,loggedInAdminUser.CategoryId)
346+
var supervisorDelegateDetails = supervisorService.GetSupervisorDelegateDetailsForAdminId(adminId, loggedInAdminUser.CategoryId)
347347
.Select(supervisor =>
348348
{
349349
return supervisor;
@@ -362,6 +362,7 @@ public IActionResult ReviewDelegateSelfAssessment(int supervisorDelegateId, int
362362
var loggedInAdminUser = userService.GetAdminUserById(adminId);
363363
var superviseDelegate =
364364
supervisorService.GetSupervisorDelegateDetailsById(supervisorDelegateId, GetAdminId(), 0);
365+
if (superviseDelegate == null) return RedirectToAction("StatusCode", "LearningSolutions", new { code = 403 });
365366
var reviewedCompetencies = PopulateCompetencyLevelDescriptors(
366367
selfAssessmentService.GetCandidateAssessmentResultsById(candidateAssessmentId, adminId, selfAssessmentResultId).ToList()
367368
);
@@ -1310,7 +1311,7 @@ public IActionResult ConfirmNominateSupervisor(SupervisorDelegateViewModel super
13101311
supervisorDelegateDetail.DelegateUserID,
13111312
(int)User.GetCentreId()
13121313
);
1313-
supervisorDelegate.SelfAssessmentCategory = supervisorDelegate.SelfAssessmentCategory == 0 ? adminUser.CategoryId.Value : supervisorDelegate.SelfAssessmentCategory;
1314+
supervisorDelegate.SelfAssessmentCategory = supervisorDelegate.SelfAssessmentCategory == 0 ? adminUser.CategoryId.Value : supervisorDelegate.SelfAssessmentCategory;
13141315
var centreName = adminUser.CentreName;
13151316

13161317
var adminRoles = new AdminRoles(false, false, true, false, false, false, false, false);
@@ -1399,7 +1400,7 @@ public IActionResult CompetencySelfAssessmentCertificatesupervisor(int candidate
13991400
{
14001401
return RedirectToAction("StatusCode", "LearningSolutions", new { code = 403 });
14011402
}
1402-
var supervisorDelegateDetails = supervisorService.GetSupervisorDelegateDetailsForAdminId(adminId.Value,loggedInAdminUser.CategoryId);
1403+
var supervisorDelegateDetails = supervisorService.GetSupervisorDelegateDetailsForAdminId(adminId.Value, loggedInAdminUser.CategoryId);
14031404
var checkSupervisorDelegate = supervisorDelegateDetails.Where(x => x.DelegateUserID == competencymaindata.LearnerId).FirstOrDefault();
14041405
if ((checkSupervisorDelegate == null))
14051406
{

0 commit comments

Comments
 (0)