diff --git a/DigitalLearningSolutions.Data/DataServices/RegistrationDataService.cs b/DigitalLearningSolutions.Data/DataServices/RegistrationDataService.cs index d6b229e721..ced09e50f3 100644 --- a/DigitalLearningSolutions.Data/DataServices/RegistrationDataService.cs +++ b/DigitalLearningSolutions.Data/DataServices/RegistrationDataService.cs @@ -197,7 +197,7 @@ public int RegisterAdmin( isSupervisor = registrationModel.IsSupervisor, isNominatedSupervisor = registrationModel.IsNominatedSupervisor, }; - + var adminUserId = connection.QuerySingle( @"INSERT INTO AdminAccounts ( @@ -219,7 +219,10 @@ OUTPUT Inserted.ID ( @userId, @centreId, - @categoryId, + CASE + WHEN @categoryID = 0 THEN NULL + ELSE @categoryID + END, @isCentreAdmin, @isCentreManager, @active, diff --git a/DigitalLearningSolutions.Web/Controllers/SupervisorController/Supervisor.cs b/DigitalLearningSolutions.Web/Controllers/SupervisorController/Supervisor.cs index e051d12737..11d8ab1e7d 100644 --- a/DigitalLearningSolutions.Web/Controllers/SupervisorController/Supervisor.cs +++ b/DigitalLearningSolutions.Web/Controllers/SupervisorController/Supervisor.cs @@ -1314,7 +1314,7 @@ public IActionResult ConfirmNominateSupervisor(SupervisorDelegateViewModel super supervisorDelegateDetail.DelegateUserID, (int)User.GetCentreId() ); - supervisorDelegate.SelfAssessmentCategory = supervisorDelegate.SelfAssessmentCategory == 0 ? adminUser.CategoryId.Value : supervisorDelegate.SelfAssessmentCategory; + supervisorDelegate.SelfAssessmentCategory = supervisorDelegate.SelfAssessmentCategory == 0 ? (adminUser.CategoryId.HasValue ? adminUser.CategoryId.Value : 0) : supervisorDelegate.SelfAssessmentCategory; var centreName = adminUser.CentreName; var adminRoles = new AdminRoles(false, false, true, false, false, false, false, false);