From d9c9b6b3112494c83e992ff187e5ecd0286f337b Mon Sep 17 00:00:00 2001 From: kevwhitt-hee Date: Wed, 27 Nov 2024 08:21:19 +0000 Subject: [PATCH 1/7] Removes migration causing an error in production data during deployment --- ...pdateCandidateAssessmentSupervisorsTabl.cs | 21 ------------------- 1 file changed, 21 deletions(-) delete mode 100644 DigitalLearningSolutions.Data.Migrations/202410071401_UpdateCandidateAssessmentSupervisorsTabl.cs diff --git a/DigitalLearningSolutions.Data.Migrations/202410071401_UpdateCandidateAssessmentSupervisorsTabl.cs b/DigitalLearningSolutions.Data.Migrations/202410071401_UpdateCandidateAssessmentSupervisorsTabl.cs deleted file mode 100644 index de95a04841..0000000000 --- a/DigitalLearningSolutions.Data.Migrations/202410071401_UpdateCandidateAssessmentSupervisorsTabl.cs +++ /dev/null @@ -1,21 +0,0 @@ - -namespace DigitalLearningSolutions.Data.Migrations -{ - using FluentMigrator; - - [Migration(202410071401)] - public class UpdateCandidateAssessmentSupervisorsTabl : ForwardOnlyMigration - { - public override void Up() - { - Execute.Sql($@"UPDATE cas - SET SelfAssessmentSupervisorRoleID = (SELECT ID FROM SelfAssessmentSupervisorRoles - WHERE SelfAssessmentID = ssr.SelfAssessmentID and AllowDelegateNomination = 1) - FROM CandidateAssessmentSupervisors cas INNER JOIN - SelfAssessmentSupervisorRoles ssr ON cas.SelfAssessmentSupervisorRoleID = ssr.ID - AND cas.Removed IS NULL AND ssr.AllowDelegateNomination = 0 INNER JOIN - SupervisorDelegates sd ON cas.SupervisorDelegateId = sd.ID INNER JOIN - AdminAccounts aa ON sd.SupervisorAdminID = aa.ID WHERE aa.IsSupervisor = 0 AND aa.IsNominatedSupervisor = 1"); - } - } -} From 85c4335a7e8adee1d4a922687e6a7d43a13ff822 Mon Sep 17 00:00:00 2001 From: kevwhitt-hee Date: Wed, 27 Nov 2024 08:23:49 +0000 Subject: [PATCH 2/7] Delete broken migration --- ...pdateCandidateAssessmentSupervisorsTabl.cs | 21 ------------------- 1 file changed, 21 deletions(-) delete mode 100644 DigitalLearningSolutions.Data.Migrations/202410071401_UpdateCandidateAssessmentSupervisorsTabl.cs diff --git a/DigitalLearningSolutions.Data.Migrations/202410071401_UpdateCandidateAssessmentSupervisorsTabl.cs b/DigitalLearningSolutions.Data.Migrations/202410071401_UpdateCandidateAssessmentSupervisorsTabl.cs deleted file mode 100644 index de95a04841..0000000000 --- a/DigitalLearningSolutions.Data.Migrations/202410071401_UpdateCandidateAssessmentSupervisorsTabl.cs +++ /dev/null @@ -1,21 +0,0 @@ - -namespace DigitalLearningSolutions.Data.Migrations -{ - using FluentMigrator; - - [Migration(202410071401)] - public class UpdateCandidateAssessmentSupervisorsTabl : ForwardOnlyMigration - { - public override void Up() - { - Execute.Sql($@"UPDATE cas - SET SelfAssessmentSupervisorRoleID = (SELECT ID FROM SelfAssessmentSupervisorRoles - WHERE SelfAssessmentID = ssr.SelfAssessmentID and AllowDelegateNomination = 1) - FROM CandidateAssessmentSupervisors cas INNER JOIN - SelfAssessmentSupervisorRoles ssr ON cas.SelfAssessmentSupervisorRoleID = ssr.ID - AND cas.Removed IS NULL AND ssr.AllowDelegateNomination = 0 INNER JOIN - SupervisorDelegates sd ON cas.SupervisorDelegateId = sd.ID INNER JOIN - AdminAccounts aa ON sd.SupervisorAdminID = aa.ID WHERE aa.IsSupervisor = 0 AND aa.IsNominatedSupervisor = 1"); - } - } -} From 8cc8f1bfe022063bfb703117ba150723cd5420d5 Mon Sep 17 00:00:00 2001 From: kevwhitt-hee Date: Wed, 27 Nov 2024 08:31:18 +0000 Subject: [PATCH 3/7] Updates other workflows to .Net 8.0 --- .github/workflows/build-and-deploy-production.yml | 4 ++-- .github/workflows/build-and-deploy-uat.yml | 4 ++-- .github/workflows/continuous-integration-workflow.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-deploy-production.yml b/.github/workflows/build-and-deploy-production.yml index 38d34a51c2..4fccdd48ac 100644 --- a/.github/workflows/build-and-deploy-production.yml +++ b/.github/workflows/build-and-deploy-production.yml @@ -19,10 +19,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup .NET Core SDK 6.0 + - name: Setup .NET Core SDK 8.0 uses: actions/setup-dotnet@v4 with: - dotnet-version: 6.0.x + dotnet-version: 8.0.x - name: Setup node uses: actions/setup-node@v4 with: diff --git a/.github/workflows/build-and-deploy-uat.yml b/.github/workflows/build-and-deploy-uat.yml index 9a82da00a9..e06b88c727 100644 --- a/.github/workflows/build-and-deploy-uat.yml +++ b/.github/workflows/build-and-deploy-uat.yml @@ -22,10 +22,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup .NET Core SDK 6.0 + - name: Setup .NET Core SDK 8.0 uses: actions/setup-dotnet@v4 with: - dotnet-version: 6.0.x + dotnet-version: 8.0.x - name: Setup node uses: actions/setup-node@v4 with: diff --git a/.github/workflows/continuous-integration-workflow.yml b/.github/workflows/continuous-integration-workflow.yml index d0019ac854..3b0ed25380 100644 --- a/.github/workflows/continuous-integration-workflow.yml +++ b/.github/workflows/continuous-integration-workflow.yml @@ -12,10 +12,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup .NET Core SDK 6.0 + - name: Setup .NET Core SDK 8.0 uses: actions/setup-dotnet@v4 with: - dotnet-version: 6.0.x + dotnet-version: 8.0.x - name: Add TechnologyEnhancedLearning as nuget package source run: dotnet nuget add source https://pkgs.dev.azure.com/e-LfH/_packaging/LearningHubFeed/nuget/v3/index.json --name TechnologyEnhancedLearning --username 'kevin.whittaker' --password ${{ secrets.AZURE_DEVOPS_PAT }} --store-password-in-clear-text From ec7910b42991e3d725875703db261d355ee42ee0 Mon Sep 17 00:00:00 2001 From: kevwhitt-hee Date: Wed, 27 Nov 2024 08:39:27 +0000 Subject: [PATCH 4/7] Update build-and-deploy-production.yml --- .github/workflows/build-and-deploy-production.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-deploy-production.yml b/.github/workflows/build-and-deploy-production.yml index 4fccdd48ac..b1579fb2d1 100644 --- a/.github/workflows/build-and-deploy-production.yml +++ b/.github/workflows/build-and-deploy-production.yml @@ -19,7 +19,7 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup .NET Core SDK 8.0 + - name: Setup .NET Core SDK 8.0 uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x From 0a24e3a9dd759bb8e2d352cf326eda637d69f41f Mon Sep 17 00:00:00 2001 From: Sherif Olaboye Date: Wed, 27 Nov 2024 10:40:01 +0000 Subject: [PATCH 5/7] TD-4973 Limit the list of supervisors in the Request proficiency confirmation view to supervisors with a matching category --- .../SelfAssessmentSupervisorDataService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DigitalLearningSolutions.Data/DataServices/SelfAssessmentDataService/SelfAssessmentSupervisorDataService.cs b/DigitalLearningSolutions.Data/DataServices/SelfAssessmentDataService/SelfAssessmentSupervisorDataService.cs index 8ae5e54133..7c3a5d118f 100644 --- a/DigitalLearningSolutions.Data/DataServices/SelfAssessmentDataService/SelfAssessmentSupervisorDataService.cs +++ b/DigitalLearningSolutions.Data/DataServices/SelfAssessmentDataService/SelfAssessmentSupervisorDataService.cs @@ -95,7 +95,8 @@ int delegateUserId WHERE (sd.Removed IS NULL) AND (cas.Removed IS NULL) AND (sd.DelegateUserID = @delegateUserId) AND (ca.SelfAssessmentID = @selfAssessmentId) AND (sd.SupervisorAdminID IS NOT NULL) AND (coalesce(sasr.ResultsReview, 1) = 1) - AND au.Active = 1 + AND au.Active = 1 + AND (au.CategoryID = 0 OR au.CategoryID IN (select CategoryID from SelfAssessments where ID = @selfAssessmentId)) ORDER BY SupervisorName", new { selfAssessmentId, delegateUserId } ); From 3c09df35d8641f7a823f85cb195f52d414df2874 Mon Sep 17 00:00:00 2001 From: Sherif Olaboye Date: Wed, 27 Nov 2024 16:35:24 +0000 Subject: [PATCH 6/7] TD-4889 Resolving internal server error when nominating delegate to supervisor --- .../DataServices/RegistrationDataService.cs | 49 +++++++++++++++++++ .../SupervisorController/Supervisor.cs | 2 +- 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/DigitalLearningSolutions.Data/DataServices/RegistrationDataService.cs b/DigitalLearningSolutions.Data/DataServices/RegistrationDataService.cs index d6b229e721..2e9e42d35e 100644 --- a/DigitalLearningSolutions.Data/DataServices/RegistrationDataService.cs +++ b/DigitalLearningSolutions.Data/DataServices/RegistrationDataService.cs @@ -197,7 +197,56 @@ public int RegisterAdmin( isSupervisor = registrationModel.IsSupervisor, isNominatedSupervisor = registrationModel.IsNominatedSupervisor, }; + if (registrationModel.CategoryId == 0) + { + var adminUserIdwithCategoryIdIsNull = connection.QuerySingle( + @"INSERT INTO AdminAccounts + ( + UserID, + CentreID, + CategoryID, + IsCentreAdmin, + IsCentreManager, + Active, + IsContentCreator, + IsContentManager, + ImportOnly, + IsTrainer, + IsSupervisor, + IsNominatedSupervisor + ) + OUTPUT Inserted.ID + VALUES + ( + @userId, + @centreId, + NULL, + @isCentreAdmin, + @isCentreManager, + @active, + @isContentCreator, + @isContentManager, + @importOnly, + @isTrainer, + @isSupervisor, + @isNominatedSupervisor + )", + adminValues, + transaction + ); + connection.Execute( + @"INSERT INTO NotificationUsers (NotificationId, AdminUserId) + SELECT N.NotificationId, @adminUserIdwithCategoryIdIsNull + FROM Notifications N INNER JOIN NotificationRoles NR + ON N.NotificationID = NR.NotificationID + WHERE RoleID IN @roles AND AutoOptIn = 1", + new { adminUserIdwithCategoryIdIsNull, roles = registrationModel.GetNotificationRoles() }, + transaction + ); + transaction.Commit(); + return adminUserIdwithCategoryIdIsNull; + } var adminUserId = connection.QuerySingle( @"INSERT INTO AdminAccounts ( 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); From fbeaa0a030c6cd733150ed84134d0e2711c7ae19 Mon Sep 17 00:00:00 2001 From: Sherif Olaboye Date: Wed, 27 Nov 2024 17:00:29 +0000 Subject: [PATCH 7/7] TD-4889 Resolving internal server error when nominating delegate to supervisor --- .../DataServices/RegistrationDataService.cs | 56 ++----------------- 1 file changed, 5 insertions(+), 51 deletions(-) diff --git a/DigitalLearningSolutions.Data/DataServices/RegistrationDataService.cs b/DigitalLearningSolutions.Data/DataServices/RegistrationDataService.cs index 2e9e42d35e..ced09e50f3 100644 --- a/DigitalLearningSolutions.Data/DataServices/RegistrationDataService.cs +++ b/DigitalLearningSolutions.Data/DataServices/RegistrationDataService.cs @@ -197,56 +197,7 @@ public int RegisterAdmin( isSupervisor = registrationModel.IsSupervisor, isNominatedSupervisor = registrationModel.IsNominatedSupervisor, }; - if (registrationModel.CategoryId == 0) - { - var adminUserIdwithCategoryIdIsNull = connection.QuerySingle( - @"INSERT INTO AdminAccounts - ( - UserID, - CentreID, - CategoryID, - IsCentreAdmin, - IsCentreManager, - Active, - IsContentCreator, - IsContentManager, - ImportOnly, - IsTrainer, - IsSupervisor, - IsNominatedSupervisor - ) - OUTPUT Inserted.ID - VALUES - ( - @userId, - @centreId, - NULL, - @isCentreAdmin, - @isCentreManager, - @active, - @isContentCreator, - @isContentManager, - @importOnly, - @isTrainer, - @isSupervisor, - @isNominatedSupervisor - )", - adminValues, - transaction - ); - - connection.Execute( - @"INSERT INTO NotificationUsers (NotificationId, AdminUserId) - SELECT N.NotificationId, @adminUserIdwithCategoryIdIsNull - FROM Notifications N INNER JOIN NotificationRoles NR - ON N.NotificationID = NR.NotificationID - WHERE RoleID IN @roles AND AutoOptIn = 1", - new { adminUserIdwithCategoryIdIsNull, roles = registrationModel.GetNotificationRoles() }, - transaction - ); - transaction.Commit(); - return adminUserIdwithCategoryIdIsNull; - } + var adminUserId = connection.QuerySingle( @"INSERT INTO AdminAccounts ( @@ -268,7 +219,10 @@ OUTPUT Inserted.ID ( @userId, @centreId, - @categoryId, + CASE + WHEN @categoryID = 0 THEN NULL + ELSE @categoryID + END, @isCentreAdmin, @isCentreManager, @active,