Skip to content

Commit b31b0f1

Browse files
authored
Merge pull request #2981 from TechnologyEnhancedLearning/Develop/Features/TD-4889-WhenasupervisorpromotesalearnertotheNominatedsupervisorrole,assignthemtothesamecategoryasthesupervisors
TD-4889 Resolving internal server error when nominating delegate to supervisor
2 parents a375ec9 + fbeaa0a commit b31b0f1

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

DigitalLearningSolutions.Data/DataServices/RegistrationDataService.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public int RegisterAdmin(
197197
isSupervisor = registrationModel.IsSupervisor,
198198
isNominatedSupervisor = registrationModel.IsNominatedSupervisor,
199199
};
200-
200+
201201
var adminUserId = connection.QuerySingle<int>(
202202
@"INSERT INTO AdminAccounts
203203
(
@@ -219,7 +219,10 @@ OUTPUT Inserted.ID
219219
(
220220
@userId,
221221
@centreId,
222-
@categoryId,
222+
CASE
223+
WHEN @categoryID = 0 THEN NULL
224+
ELSE @categoryID
225+
END,
223226
@isCentreAdmin,
224227
@isCentreManager,
225228
@active,

DigitalLearningSolutions.Web/Controllers/SupervisorController/Supervisor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1314,7 +1314,7 @@ public IActionResult ConfirmNominateSupervisor(SupervisorDelegateViewModel super
13141314
supervisorDelegateDetail.DelegateUserID,
13151315
(int)User.GetCentreId()
13161316
);
1317-
supervisorDelegate.SelfAssessmentCategory = supervisorDelegate.SelfAssessmentCategory == 0 ? adminUser.CategoryId.Value : supervisorDelegate.SelfAssessmentCategory;
1317+
supervisorDelegate.SelfAssessmentCategory = supervisorDelegate.SelfAssessmentCategory == 0 ? (adminUser.CategoryId.HasValue ? adminUser.CategoryId.Value : 0) : supervisorDelegate.SelfAssessmentCategory;
13181318
var centreName = adminUser.CentreName;
13191319

13201320
var adminRoles = new AdminRoles(false, false, true, false, false, false, false, false);

0 commit comments

Comments
 (0)