From 9a12aaeb4f652a65e7d6732463b19bfbc0928134 Mon Sep 17 00:00:00 2001 From: Auldrin-Possa Date: Mon, 1 Sep 2025 16:07:04 +0100 Subject: [PATCH 1/2] TD-5638 - 'Assessor', 'Educator/Manager' have been changed to 'Supervisor', 'Nominated Supervisor' respectively. Changes have been made to the view, backend, stored procedure. --- ...nTitlesAddSupervisorNominatedSupervisor.cs | 63 ++++++++++++ ...lterGetCandidateAssessmentResultsByIdSP.cs | 17 ++++ ...0_AlterGetAssessmentResultsByDelegateSP.cs | 19 ++++ .../Properties/Resources.Designer.cs | 96 ++++++++++++++++++ .../Properties/Resources.resx | 12 +++ ...er_GetAssessmentResultsByDelegate_DOWN.sql | Bin 0 -> 10480 bytes ...lter_GetAssessmentResultsByDelegate_Up.sql | Bin 0 -> 10842 bytes ...GetCandidateAssessmentResultsById_DOWN.sql | Bin 0 -> 10998 bytes ...r_GetCandidateAssessmentResultsById_Up.sql | Bin 0 -> 11356 bytes .../CandidateAssessmentsDataService.cs | 17 +++- .../CompetencyDataService.cs | 7 +- .../DataServices/SupervisorDataService.cs | 11 +- .../SelfAssessmentSupervisorRole.cs | 2 +- .../SupervisorControllerTests.cs | 6 +- .../TestHelpers/SupervisorTagTestHelper.cs | 83 +++++++-------- .../SupervisorController/Supervisor.cs | 10 +- ...SelfAssessmentCertificateSecondPage.cshtml | 4 +- .../_DelegateProfileAssessmentGrid.cshtml | 2 +- .../_DelegateSelfAssessmentDetails.cshtml | 3 +- 19 files changed, 289 insertions(+), 63 deletions(-) create mode 100644 DigitalLearningSolutions.Data.Migrations/202508261415_RemoveCustomAdminTitlesAddSupervisorNominatedSupervisor.cs create mode 100644 DigitalLearningSolutions.Data.Migrations/202508281600_AlterGetCandidateAssessmentResultsByIdSP.cs create mode 100644 DigitalLearningSolutions.Data.Migrations/202508281630_AlterGetAssessmentResultsByDelegateSP.cs create mode 100644 DigitalLearningSolutions.Data.Migrations/Scripts/TD-5638-Alter_GetAssessmentResultsByDelegate_DOWN.sql create mode 100644 DigitalLearningSolutions.Data.Migrations/Scripts/TD-5638-Alter_GetAssessmentResultsByDelegate_Up.sql create mode 100644 DigitalLearningSolutions.Data.Migrations/Scripts/TD-5638-Alter_GetCandidateAssessmentResultsById_DOWN.sql create mode 100644 DigitalLearningSolutions.Data.Migrations/Scripts/TD-5638-Alter_GetCandidateAssessmentResultsById_Up.sql diff --git a/DigitalLearningSolutions.Data.Migrations/202508261415_RemoveCustomAdminTitlesAddSupervisorNominatedSupervisor.cs b/DigitalLearningSolutions.Data.Migrations/202508261415_RemoveCustomAdminTitlesAddSupervisorNominatedSupervisor.cs new file mode 100644 index 0000000000..2610dd1a75 --- /dev/null +++ b/DigitalLearningSolutions.Data.Migrations/202508261415_RemoveCustomAdminTitlesAddSupervisorNominatedSupervisor.cs @@ -0,0 +1,63 @@ +namespace DigitalLearningSolutions.Data.Migrations +{ + using FluentMigrator; + + [Migration(202508261415)] + public class RemoveCustomAdminTitlesAddSupervisorNominatedSupervisor : ForwardOnlyMigration + { + public override void Up() + { + Execute.Sql($@" + -- 1. Drop old FK + ALTER TABLE [dbo].[SelfAssessmentSupervisorRoles] + DROP CONSTRAINT [FK_SelfAssessmentSupervisorRoles_SelfAssessmentID_SelfAssessments_ID]; + + + -- 2. Make column nullable + ALTER TABLE [dbo].[SelfAssessmentSupervisorRoles] + ALTER COLUMN SelfAssessmentID INT NULL; + + + -- 3. Recreate FK (allows NULLs by default) + ALTER TABLE [dbo].[SelfAssessmentSupervisorRoles] + ADD CONSTRAINT [FK_SelfAssessmentSupervisorRoles_SelfAssessmentID_SelfAssessments_ID] + FOREIGN KEY (SelfAssessmentID) REFERENCES SelfAssessments(ID); + + + -- 4. Add two default roles + INSERT INTO [dbo].[SelfAssessmentSupervisorRoles] + ([SelfAssessmentID],[RoleName],[SelfAssessmentReview],[ResultsReview] + ,[RoleDescription] + ,[AllowDelegateNomination],[AllowSupervisorRoleSelection]) + VALUES + (NULL,'Supervisor',1,1 + ,'This person may be the line manager, practice educator or educational supervisor at University.' + ,0,1), + (NULL,'Nominated Supervisor',0,1 + ,'Nominated Supervisors must be deemed competent to administer intravenous medication by their home organisation. Nominated Supervisors should be authorised to supervise and assess the practice of others by their line manager, who should consider their level of experience.' + ,1,0); + + + -- 5. Update all CandidateAssessmentSupervisor records + UPDATE cas + SET cas.SelfAssessmentSupervisorRoleID = +    CASE +        WHEN sasr.RoleName = 'Educator/Manager' THEN sup.ID +        WHEN sasr.RoleName = 'Assessor'         THEN nom.ID +    END + FROM CandidateAssessmentSupervisors cas + INNER JOIN SelfAssessmentSupervisorRoles sasr +    ON cas.SelfAssessmentSupervisorRoleID = sasr.ID + LEFT JOIN SelfAssessmentSupervisorRoles sup +    ON sup.RoleName = 'Supervisor' + LEFT JOIN SelfAssessmentSupervisorRoles nom +    ON nom.RoleName = 'Nominated Supervisor'; + + + -- 6. Remove all existing roles where SelfAssessmentID is not null + DELETE FROM SelfAssessmentSupervisorRoles WHERE SelfAssessmentID IS NOT NULL; + " + ); + } + } +} diff --git a/DigitalLearningSolutions.Data.Migrations/202508281600_AlterGetCandidateAssessmentResultsByIdSP.cs b/DigitalLearningSolutions.Data.Migrations/202508281600_AlterGetCandidateAssessmentResultsByIdSP.cs new file mode 100644 index 0000000000..d1036e83f0 --- /dev/null +++ b/DigitalLearningSolutions.Data.Migrations/202508281600_AlterGetCandidateAssessmentResultsByIdSP.cs @@ -0,0 +1,17 @@ +namespace DigitalLearningSolutions.Data.Migrations +{ + using FluentMigrator; + + [Migration(202508281600)] + public class AlterGetCandidateAssessmentResultsByIdSP : Migration + { + public override void Up() + { + Execute.Sql(Properties.Resources.TD_5638_Alter_GetCandidateAssessmentResultsById_Up); + } + public override void Down() + { + Execute.Sql(Properties.Resources.TD_5638_Alter_GetCandidateAssessmentResultsById_DOWN); + } + } +} diff --git a/DigitalLearningSolutions.Data.Migrations/202508281630_AlterGetAssessmentResultsByDelegateSP.cs b/DigitalLearningSolutions.Data.Migrations/202508281630_AlterGetAssessmentResultsByDelegateSP.cs new file mode 100644 index 0000000000..cda3d4dd83 --- /dev/null +++ b/DigitalLearningSolutions.Data.Migrations/202508281630_AlterGetAssessmentResultsByDelegateSP.cs @@ -0,0 +1,19 @@ + + +namespace DigitalLearningSolutions.Data.Migrations +{ + using FluentMigrator; + + [Migration(202508281630)] + public class AlterGetAssessmentResultsByDelegateSP : Migration + { + public override void Up() + { + Execute.Sql(Properties.Resources.TD_5638_Alter_GetAssessmentResultsByDelegate_Up); + } + public override void Down() + { + Execute.Sql(Properties.Resources.TD_5638_Alter_GetAssessmentResultsByDelegate_DOWN); + } + } +} diff --git a/DigitalLearningSolutions.Data.Migrations/Properties/Resources.Designer.cs b/DigitalLearningSolutions.Data.Migrations/Properties/Resources.Designer.cs index 631af7bc66..f07492a60b 100644 --- a/DigitalLearningSolutions.Data.Migrations/Properties/Resources.Designer.cs +++ b/DigitalLearningSolutions.Data.Migrations/Properties/Resources.Designer.cs @@ -2564,6 +2564,102 @@ internal static string TD_5535_Alter_GetActivitiesForDelegateEnrolment_Up { } } + /// + /// Looks up a localized string similar to /****** Object: StoredProcedure [dbo].[GetAssessmentResultsByDelegate] Script Date: 28/08/2025 16:32:01 ******/ + ///SET ANSI_NULLS ON + ///GO + /// + ///SET QUOTED_IDENTIFIER ON + ///GO + /// + ///-- ============================================= + ///-- Author: Auldrin Possa + ///-- Create date: 30/11/2023 + ///-- Description: Returns assessment results for a delegate + ///-- ============================================= + ///ALTER PROCEDURE [dbo].[GetAssessmentResultsByDelegate] + /// @selfAssessmentId as Int = 0, + /// @delegateId as int = 0 + ///AS + ///BEGIN [rest of string was truncated]";. + /// + internal static string TD_5638_Alter_GetAssessmentResultsByDelegate_DOWN { + get { + return ResourceManager.GetString("TD_5638_Alter_GetAssessmentResultsByDelegate_DOWN", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to /****** Object: StoredProcedure [dbo].[GetAssessmentResultsByDelegate] Script Date: 28/08/2025 16:32:01 ******/ + ///SET ANSI_NULLS ON + ///GO + /// + ///SET QUOTED_IDENTIFIER ON + ///GO + /// + ///-- ============================================= + ///-- Author: Auldrin Possa + ///-- Create date: 30/11/2023 + ///-- Description: Returns assessment results for a delegate + ///-- ============================================= + ///ALTER PROCEDURE [dbo].[GetAssessmentResultsByDelegate] + /// @selfAssessmentId as Int = 0, + /// @delegateId as int = 0 + ///AS + ///BEGIN [rest of string was truncated]";. + /// + internal static string TD_5638_Alter_GetAssessmentResultsByDelegate_Up { + get { + return ResourceManager.GetString("TD_5638_Alter_GetAssessmentResultsByDelegate_Up", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to /****** Object: StoredProcedure [dbo].[GetCandidateAssessmentResultsById] Script Date: 28/08/2025 16:46:37 ******/ + ///SET ANSI_NULLS ON + ///GO + /// + ///SET QUOTED_IDENTIFIER ON + ///GO + /// + ///-- ============================================= + ///-- Author: Auldrin Possa + ///-- Create date: 30/11/2023 + ///-- Description: Returns candidate assessment results by candidateAssessmentId + ///-- ============================================= + ///ALTER PROCEDURE [dbo].[GetCandidateAssessmentResultsById] + /// @candidateAssessmentId as Int = 0, + /// @a [rest of string was truncated]";. + /// + internal static string TD_5638_Alter_GetCandidateAssessmentResultsById_DOWN { + get { + return ResourceManager.GetString("TD_5638_Alter_GetCandidateAssessmentResultsById_DOWN", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to /****** Object: StoredProcedure [dbo].[GetCandidateAssessmentResultsById] Script Date: 28/08/2025 16:46:37 ******/ + ///SET ANSI_NULLS ON + ///GO + /// + ///SET QUOTED_IDENTIFIER ON + ///GO + /// + ///-- ============================================= + ///-- Author: Auldrin Possa + ///-- Create date: 30/11/2023 + ///-- Description: Returns candidate assessment results by candidateAssessmentId + ///-- ============================================= + ///ALTER PROCEDURE [dbo].[GetCandidateAssessmentResultsById] + /// @candidateAssessmentId as Int = 0, + /// @a [rest of string was truncated]";. + /// + internal static string TD_5638_Alter_GetCandidateAssessmentResultsById_Up { + get { + return ResourceManager.GetString("TD_5638_Alter_GetCandidateAssessmentResultsById_Up", resourceCulture); + } + } + /// /// Looks up a localized string similar to IF OBJECT_ID('dbo.IndexOptimize', 'P') IS NOT NULL DROP PROCEDURE dbo.IndexOptimize; ///IF OBJECT_ID('dbo.CommandExecute', 'P') IS NOT NULL DROP PROCEDURE dbo.CommandExecute; diff --git a/DigitalLearningSolutions.Data.Migrations/Properties/Resources.resx b/DigitalLearningSolutions.Data.Migrations/Properties/Resources.resx index 41e1de40a2..418da257f0 100644 --- a/DigitalLearningSolutions.Data.Migrations/Properties/Resources.resx +++ b/DigitalLearningSolutions.Data.Migrations/Properties/Resources.resx @@ -505,4 +505,16 @@ ..\Scripts\TD-5535-Alter_GetActivitiesForDelegateEnrolment_Up.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16 + + ..\Scripts\TD-5638-Alter_GetAssessmentResultsByDelegate_DOWN.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16 + + + ..\Scripts\TD-5638-Alter_GetAssessmentResultsByDelegate_Up.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16 + + + ..\Scripts\TD-5638-Alter_GetCandidateAssessmentResultsById_DOWN.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16 + + + ..\Scripts\TD-5638-Alter_GetCandidateAssessmentResultsById_Up.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16 + \ No newline at end of file diff --git a/DigitalLearningSolutions.Data.Migrations/Scripts/TD-5638-Alter_GetAssessmentResultsByDelegate_DOWN.sql b/DigitalLearningSolutions.Data.Migrations/Scripts/TD-5638-Alter_GetAssessmentResultsByDelegate_DOWN.sql new file mode 100644 index 0000000000000000000000000000000000000000..5b9c8fe0689dfc1dcdf23a8de23ce70dea0bb366 GIT binary patch literal 10480 zcmcgyZBH9V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)2Q({VRer{A`XGDRi*K9fS?1AFHkTtbFSSH5G z?0dE*eh5r`yM~s1h->5^?hH)fmv?xtI!Wmr0=k^f6KT4{+zV86-_<$y)~nP#$U(q&ev{h8B!WreESq*fy# z-s)p>_0p`*tdzN~Thm^sV(@jPz0Oz;RJaiDx~?ERPp+U`r67{=_ou40UA(djSCI2K zKfx#G_hsw(#`QtO^J5%WYe|h1p_yHsqBUO(Z&b7U=@pZ$ryR))l#nsUV6qYY9sCg48gs`Tkcl(F;@Ry zL29LY7M1|36u;hE)OX*;?Amvi`RkC**I84tTS%B{=iTuj-+ca=k$pHg@w|w@Cb5ar_^$NqJRX z#H_FR=DDxu))v70VDDj}hM&XA1E<>8`PFE8PSFJ0PqcK`qY literal 0 HcmV?d00001 diff --git a/DigitalLearningSolutions.Data.Migrations/Scripts/TD-5638-Alter_GetAssessmentResultsByDelegate_Up.sql b/DigitalLearningSolutions.Data.Migrations/Scripts/TD-5638-Alter_GetAssessmentResultsByDelegate_Up.sql new file mode 100644 index 0000000000000000000000000000000000000000..47a0c112a332191f068a17b488b217e9fca5b029 GIT binary patch literal 10842 zcmd5?ZEqVz5ZKCCeY@k6$k}^>N<8BNaHk4QV>Fs8z&*faf;7r>7NIlXUCJ> zJFj>5Op4Iyd~Z9m^FFh){`;?W^M!X5rf1%mx8~fOnW@<_1&%)MZp;MlhUNg*8+_ya zt$kORUvU2hZ+|swxZlCIscD%K$GQEz#&wK$hxYl_jBsC?=jNl?#+wn&OEbW`b70_n zGUpkvUzvA!UtpYkCp}NhH)h>z*xx6(J~3b6?WXw})IP=27T#^*jnCD(`P_U4K04+I zUs`4#_q*m4*JHDXqmQ>eJaNaBzosD`e9dko1xusWVv%NS!s0gUr@P}o^ZOCK$vFc+3?jwTgVn{YgSS~<30 z2h=ci$>RWbJ=3;2KgN9r@9xvm$=3t(4E&Sdi=fBsLK-5&0(M3pqBRxJ%_FM~!q?^H z!%*`MhBLNc>%2Y(KRduFHZQcOf9zYnd$4)hxLEeL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|oMo<>!gswbs-9eZ zQH~Z4F=m#OQHyA)G$C!2#}ZqjKS~xOQYj}nm#y%&NiIcXztxwsnReZ@@jdPAzb%o41PSTK6hq3}e@6-4~{+g^D z#H?Z6a>5pR(r^6PFl#6sS#neT3`N${NacmC>w4x_RD7&a`=}%(ldj?Z6mdbGcFb@1 zI9!DykD}fr@$u{HLIz=txXw zFV29=Shy(H!FN8T(DtK|P_A;#Rex5Gj8Gai)@!Wp0a}hQ#~xvYc!KE2Ip`f`==6Ds zH|NkHY&F zq7R$VH8W<_I*VXca)sP6g7xIE4(_eIw|rG2eVkU?oGkoCWvtJL(x<$Zn=;N*aQrv2 zrdAHC#8?^qDST^sFO&xGN5)msyM)hkZ^*3-NVcrgW0vYj8 zw=sDRq*mz_M&W3~A5eG;i&W22R|?dw`=-{t5i9@;X-Wzi?%I|ZwHLiL{!Zhgb|fNldDQQ1N$ zIO@K1Tziq{{|lcw?@EgqWhuI{yO~9?uW} literal 0 HcmV?d00001 diff --git a/DigitalLearningSolutions.Data.Migrations/Scripts/TD-5638-Alter_GetCandidateAssessmentResultsById_Up.sql b/DigitalLearningSolutions.Data.Migrations/Scripts/TD-5638-Alter_GetCandidateAssessmentResultsById_Up.sql new file mode 100644 index 0000000000000000000000000000000000000000..97dc90159fb480167f0005cde608ed0c15cec3b9 GIT binary patch literal 11356 zcmd5?ZBH9V5ZVLRzfwqAFeN(DdHDDWBViRmgt13bcaR@D#)Mt|N=i5Hdjwic! zx8B=xh+0|pz3tA_&CISDnF;P+;yc3i*tATJ&)EK6<2b?HV|#sTu5g~49dl<6 zF#fq+RaQR78kgn`o@ZunPKjJ?nQzU8d1QaLaNIIq;qIpS8a#h#f49vyxZ}&VVLmmV zK$^B0;z`T&aDHIUa6B=G_zZBjk1LMq;*3Xs##4;zV{RLqoMGl3&U&~$Fdcl`kS09; zp?QcW-+#0Zd6YF;(8Py9|KR3GhGO#48TekR`a zot-7)o?+h5?BmHHBw>`v@f*UT7-{JJvbt!m`nzgZs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LearningSolutions.Data/DataServices/SelfAssessmentDataService/CandidateAssessmentsDataService.cs index 48b267fa2e..c882f850d2 100644 --- a/DigitalLearningSolutions.Data/DataServices/SelfAssessmentDataService/CandidateAssessmentsDataService.cs +++ b/DigitalLearningSolutions.Data/DataServices/SelfAssessmentDataService/CandidateAssessmentsDataService.cs @@ -202,22 +202,29 @@ CandidateAssessments AS CA LEFT OUTER JOIN CAST(CASE WHEN CA.SelfAssessmentProcessAgreed IS NOT NULL THEN 1 ELSE 0 END AS BIT) AS SelfAssessmentProcessAgreed, CAST(CASE WHEN SA.SupervisorSelfAssessmentReview = 1 OR SA.SupervisorResultsReview = 1 THEN 1 ELSE 0 END AS BIT) AS IsSupervised, CASE - WHEN (SELECT COUNT(*) FROM SelfAssessmentSupervisorRoles WHERE SelfAssessmentID = @selfAssessmentId AND AllowDelegateNomination = 1) > 0 + WHEN (SELECT COUNT(*) FROM SelfAssessmentSupervisorRoles WHERE + (SelfAssessmentID = @selfAssessmentId OR + (SelfAssessmentID IS NULL AND NOT EXISTS (SELECT 1 FROM SelfAssessmentSupervisorRoles WHERE SelfAssessmentID = @selfAssessmentId))) + AND AllowDelegateNomination = 1) > 0 THEN 1 ELSE 0 END AS HasDelegateNominatedRoles, COALESCE( (SELECT TOP (1) RoleName FROM SelfAssessmentSupervisorRoles - WHERE (ResultsReview = 1) AND (SelfAssessmentID = @selfAssessmentId) AND + WHERE (ResultsReview = 1) AND (SelfAssessmentID = @selfAssessmentId OR + (SelfAssessmentID IS NULL AND NOT EXISTS (SELECT 1 FROM SelfAssessmentSupervisorRoles WHERE SelfAssessmentID = @selfAssessmentId))) AND ((SELECT COUNT(*) AS Expr1 FROM SelfAssessmentSupervisorRoles AS SelfAssessmentSupervisorRoles_1 - WHERE (ResultsReview = 1) AND (SelfAssessmentID = @selfAssessmentId)) = 1)), + WHERE (ResultsReview = 1) AND (SelfAssessmentID = @selfAssessmentId OR + (SelfAssessmentID IS NULL AND NOT EXISTS (SELECT 1 FROM SelfAssessmentSupervisorRoles WHERE SelfAssessmentID = @selfAssessmentId)))) = 1)), 'Supervisor') AS VerificationRoleName, COALESCE( (SELECT TOP (1) RoleName FROM SelfAssessmentSupervisorRoles - WHERE (SelfAssessmentReview = 1) AND (SelfAssessmentID = @selfAssessmentId) AND + WHERE (SelfAssessmentReview = 1) AND (SelfAssessmentID = @selfAssessmentId OR + (SelfAssessmentID IS NULL AND NOT EXISTS (SELECT 1 FROM SelfAssessmentSupervisorRoles WHERE SelfAssessmentID = @selfAssessmentId))) AND ((SELECT COUNT(*) AS Expr1 FROM SelfAssessmentSupervisorRoles AS SelfAssessmentSupervisorRoles_1 - WHERE (SelfAssessmentReview = 1) AND (SelfAssessmentID = @selfAssessmentId)) = 1)), + WHERE (SelfAssessmentReview = 1) AND (SelfAssessmentID = @selfAssessmentId OR + (SelfAssessmentID IS NULL AND NOT EXISTS (SELECT 1 FROM SelfAssessmentSupervisorRoles WHERE SelfAssessmentID = @selfAssessmentId)))) = 1)), 'Supervisor') AS SignOffRoleName, SA.SignOffRequestorStatement, SA.ManageSupervisorsDescription, diff --git a/DigitalLearningSolutions.Data/DataServices/SelfAssessmentDataService/CompetencyDataService.cs b/DigitalLearningSolutions.Data/DataServices/SelfAssessmentDataService/CompetencyDataService.cs index 3c333e78e8..8872fbc372 100644 --- a/DigitalLearningSolutions.Data/DataServices/SelfAssessmentDataService/CompetencyDataService.cs +++ b/DigitalLearningSolutions.Data/DataServices/SelfAssessmentDataService/CompetencyDataService.cs @@ -100,7 +100,10 @@ INNER JOIN FrameworkCompetencies AS FC WHERE FC.CompetencyID = C.ID), 'Capability') AS Vocabulary, CASE - WHEN (SELECT COUNT(*) FROM SelfAssessmentSupervisorRoles WHERE SelfAssessmentID = SAS.SelfAssessmentID) > 0 + WHEN (SELECT COUNT(*) FROM SelfAssessmentSupervisorRoles + WHERE (SelfAssessmentID = SAS.SelfAssessmentID OR + (SelfAssessmentID IS NULL AND NOT EXISTS + (SELECT 1 FROM SelfAssessmentSupervisorRoles WHERE SelfAssessmentID = SAS.SelfAssessmentID)))) > 0 THEN 1 ELSE 0 END AS HasDelegateNominatedRoles, @@ -642,7 +645,7 @@ FROM SelfAssessmentResults s inner join public void RemoveReviewCandidateAssessmentOptionalCompetencies(int id) { - + connection.Execute( @"delete from SelfAssessmentResultSupervisorVerifications WHERE SelfAssessmentResultId = @id", new { id }); diff --git a/DigitalLearningSolutions.Data/DataServices/SupervisorDataService.cs b/DigitalLearningSolutions.Data/DataServices/SupervisorDataService.cs index dd435aa1e8..162a9c3e4f 100644 --- a/DigitalLearningSolutions.Data/DataServices/SupervisorDataService.cs +++ b/DigitalLearningSolutions.Data/DataServices/SupervisorDataService.cs @@ -829,7 +829,8 @@ public IEnumerable GetSupervisorRolesForSelfAssess return connection.Query( $@"SELECT ID, SelfAssessmentID, RoleName, RoleDescription, SelfAssessmentReview, ResultsReview,AllowSupervisorRoleSelection FROM SelfAssessmentSupervisorRoles - WHERE (SelfAssessmentID = @selfAssessmentId) + WHERE SelfAssessmentID = @selfAssessmentId OR + (SelfAssessmentID IS NULL AND NOT EXISTS (SELECT 1 FROM SelfAssessmentSupervisorRoles WHERE SelfAssessmentID = @selfAssessmentId)) ORDER BY RoleName", new { selfAssessmentId } ); } @@ -839,7 +840,9 @@ public IEnumerable GetSupervisorRolesBySelfAssessm return connection.Query( $@"SELECT ID, SelfAssessmentID, RoleName, RoleDescription, SelfAssessmentReview, ResultsReview FROM SelfAssessmentSupervisorRoles - WHERE (SelfAssessmentID = @selfAssessmentId) AND (AllowSupervisorRoleSelection = 1) + WHERE (SelfAssessmentID = @selfAssessmentId OR + (SelfAssessmentID IS NULL AND NOT EXISTS (SELECT 1 FROM SelfAssessmentSupervisorRoles WHERE SelfAssessmentID = @selfAssessmentId))) + AND (AllowSupervisorRoleSelection = 1) ORDER BY RoleName", new { selfAssessmentId } ); } @@ -848,7 +851,9 @@ public IEnumerable GetDelegateNominatableSuperviso return connection.Query( $@"SELECT ID, SelfAssessmentID, RoleName, RoleDescription, SelfAssessmentReview, ResultsReview FROM SelfAssessmentSupervisorRoles - WHERE (SelfAssessmentID = @selfAssessmentId) AND (AllowDelegateNomination = 1) + WHERE (SelfAssessmentID = @selfAssessmentId OR + (SelfAssessmentID IS NULL AND NOT EXISTS (SELECT 1 FROM SelfAssessmentSupervisorRoles WHERE SelfAssessmentID = @selfAssessmentId))) + AND (AllowDelegateNomination = 1) ORDER BY RoleName", new { selfAssessmentId } ); } diff --git a/DigitalLearningSolutions.Data/Models/Supervisor/SelfAssessmentSupervisorRole.cs b/DigitalLearningSolutions.Data/Models/Supervisor/SelfAssessmentSupervisorRole.cs index d9f567eb55..0b0f776c49 100644 --- a/DigitalLearningSolutions.Data/Models/Supervisor/SelfAssessmentSupervisorRole.cs +++ b/DigitalLearningSolutions.Data/Models/Supervisor/SelfAssessmentSupervisorRole.cs @@ -7,7 +7,7 @@ namespace DigitalLearningSolutions.Data.Models.Supervisor public class SelfAssessmentSupervisorRole { public int ID { get; set; } - public int SelfAssessmentID { get; set; } + public int? SelfAssessmentID { get; set; } public string RoleName { get; set; } = string.Empty; public string? RoleDescription { get; set; } public bool SelfAssessmentReview { get; set; } diff --git a/DigitalLearningSolutions.Web.Tests/Controllers/SupervisorController/SupervisorControllerTests.cs b/DigitalLearningSolutions.Web.Tests/Controllers/SupervisorController/SupervisorControllerTests.cs index 7dddbd0e55..82c92d182a 100644 --- a/DigitalLearningSolutions.Web.Tests/Controllers/SupervisorController/SupervisorControllerTests.cs +++ b/DigitalLearningSolutions.Web.Tests/Controllers/SupervisorController/SupervisorControllerTests.cs @@ -188,7 +188,7 @@ public void ReviewDelegateSelfAssessment_Should_Return_View_With_Optional_Compet IsSupervisorResultsReviewed = delegateSelfAssessment.IsSupervisorResultsReviewed, SearchViewModel = search, CandidateAssessmentId = candidateAssessmentId, - ExportToExcelHide = delegateSelfAssessment.SupervisorRoleTitle?.Contains("Assessor") ?? false, + ExportToExcelHide = delegateSelfAssessment.SupervisorRoleTitle?.Contains("Nominated Supervisor") ?? false, SupervisorSignOffs = supervisorSignOffs, CompetencySummaries = competencySummaries }; @@ -211,7 +211,7 @@ public void ReviewDelegateSelfAssessment_Should_Return_View_With_Optional_Compet result.Should().BeViewResult() .WithViewName("ReviewSelfAssessment") .ModelAs() - .CompetencyGroups ?.SelectMany(group => group).FirstOrDefault(x => x.Id == 1)?.Optional.Should().Be(true); + .CompetencyGroups?.SelectMany(group => group).FirstOrDefault(x => x.Id == 1)?.Optional.Should().Be(true); result.Should().BeViewResult() .WithViewName("ReviewSelfAssessment") .ModelAs() @@ -250,7 +250,7 @@ public void ReviewDelegateSelfAssessment_Should_Return_View_With_Optional_Filter IsSupervisorResultsReviewed = delegateSelfAssessment.IsSupervisorResultsReviewed, SearchViewModel = searchViewModel, CandidateAssessmentId = candidateAssessmentId, - ExportToExcelHide = delegateSelfAssessment.SupervisorRoleTitle?.Contains("Assessor") ?? false, + ExportToExcelHide = delegateSelfAssessment.SupervisorRoleTitle?.Contains("Nominated Supervisor") ?? false, SupervisorSignOffs = supervisorSignOffs, CompetencySummaries = competencySummaries }; diff --git a/DigitalLearningSolutions.Web.Tests/TestHelpers/SupervisorTagTestHelper.cs b/DigitalLearningSolutions.Web.Tests/TestHelpers/SupervisorTagTestHelper.cs index e55cc5fe1a..456d512d56 100644 --- a/DigitalLearningSolutions.Web.Tests/TestHelpers/SupervisorTagTestHelper.cs +++ b/DigitalLearningSolutions.Web.Tests/TestHelpers/SupervisorTagTestHelper.cs @@ -9,9 +9,9 @@ public static class SupervisorTagTestHelper private static readonly IClockUtility ClockUtility = new ClockUtility(); public static SupervisorDelegateDetail CreateDefaultSupervisorDelegateDetail( - int id =1, + int id = 1, string supervisorEmail = "email@test.com", - string SupervisorName = "Supervisor", + string SupervisorName = "Supervisor", int? supervisorAdminID = 1, int centreId = 101, string delegateEmail = "email@test.com", @@ -20,10 +20,10 @@ public static SupervisorDelegateDetail CreateDefaultSupervisorDelegateDetail( DateTime? removed = null, string? firstName = null, string? lastName = null, - string candidateNumber = "DELEGATE", + string candidateNumber = "DELEGATE", string candidateEmail = "email@test.com", - string? jobGroupName =null, - string? customPrompt1 =null, + string? jobGroupName = null, + string? customPrompt1 = null, string? answer1 = null, string? customPrompt2 = null, string? answer2 = null, @@ -36,13 +36,13 @@ public static SupervisorDelegateDetail CreateDefaultSupervisorDelegateDetail( string? customPrompt6 = null, string? answer6 = null, string? supervisorName = null, - int candidateAssessmentCount =0, - Guid? InviteHash =null, + int candidateAssessmentCount = 0, + Guid? InviteHash = null, bool delegateIsNominatedSupervisor = false, bool delegateIsSupervisor = false, string professionalRegistrationNumber = "string.Empty", int? delegateID = 0, - bool? active =false + bool? active = false ) { return new SupervisorDelegateDetail @@ -52,23 +52,23 @@ public static SupervisorDelegateDetail CreateDefaultSupervisorDelegateDetail( FirstName = firstName, LastName = lastName, CentreId = centreId, - CandidateAssessmentCount = candidateAssessmentCount, - CandidateNumber = candidateNumber, - CandidateEmail = candidateEmail, - Answer1 = answer1, - Answer2 = answer2, - Answer3 = answer3, - Answer4 = answer4, - Answer5 = answer5, - Answer6 = answer6, - JobGroupName = jobGroupName, - DelegateEmail = delegateEmail, - DelegateID = delegateID, - DelegateIsNominatedSupervisor= delegateIsNominatedSupervisor, - DelegateIsSupervisor= delegateIsSupervisor, - DelegateUserID = delegateUserID, + CandidateAssessmentCount = candidateAssessmentCount, + CandidateNumber = candidateNumber, + CandidateEmail = candidateEmail, + Answer1 = answer1, + Answer2 = answer2, + Answer3 = answer3, + Answer4 = answer4, + Answer5 = answer5, + Answer6 = answer6, + JobGroupName = jobGroupName, + DelegateEmail = delegateEmail, + DelegateID = delegateID, + DelegateIsNominatedSupervisor = delegateIsNominatedSupervisor, + DelegateIsSupervisor = delegateIsSupervisor, + DelegateUserID = delegateUserID, SupervisorAdminID = supervisorAdminID, - SupervisorEmail= supervisorEmail, + SupervisorEmail = supervisorEmail, SupervisorName = supervisorName, CustomPrompt1 = customPrompt1, CustomPrompt2 = customPrompt2, @@ -79,47 +79,48 @@ public static SupervisorDelegateDetail CreateDefaultSupervisorDelegateDetail( Removed = removed, InviteHash = InviteHash, ProfessionalRegistrationNumber = professionalRegistrationNumber, - + }; } public static DelegateSelfAssessment CreateDefaultDelegateSelfAssessment( int id = 1, - int selfAssessmentID =6, - int delegateUserID =1, - string? roleName =null, - bool supervisorSelfAssessmentReview =false, + int selfAssessmentID = 6, + int delegateUserID = 1, + string? roleName = null, + bool supervisorSelfAssessmentReview = false, bool supervisorResultsReview = false, - string? supervisorRoleTitle = "Assessor", - DateTime? signedOffDate =null, + string? supervisorRoleTitle = "Nominated Supervisor", + DateTime? signedOffDate = null, bool signedOff = false, - DateTime? completeByDate=null, + DateTime? completeByDate = null, int launchCount = 0, - DateTime? completedDate =null, + DateTime? completedDate = null, string? professionalGroup = null, string? questionLabel = null, string? descriptionLabel = null, string? reviewerCommentsLabel = null, string? subGroup = null, string? roleProfile = null, - int signOffRequested =1, - int resultsVerificationRequests =1, - bool isSupervisorResultsReviewed =false, + int signOffRequested = 1, + int resultsVerificationRequests = 1, + bool isSupervisorResultsReviewed = false, bool isAssignedToSupervisor = false, bool nonReportable = false ) { - return new DelegateSelfAssessment { + return new DelegateSelfAssessment + { ID = id, SelfAssessmentID = selfAssessmentID, DelegateUserID = delegateUserID, ResultsVerificationRequests = resultsVerificationRequests, - ReviewerCommentsLabel = reviewerCommentsLabel, + ReviewerCommentsLabel = reviewerCommentsLabel, SubGroup = subGroup, RoleProfile = roleProfile, SignOffRequested = signOffRequested, SupervisorResultsReview = supervisorResultsReview, - SupervisorSelfAssessmentReview= supervisorSelfAssessmentReview, + SupervisorSelfAssessmentReview = supervisorSelfAssessmentReview, SignedOff = signedOff, CompleteByDate = completeByDate, LaunchCount = launchCount, @@ -130,10 +131,10 @@ public static DelegateSelfAssessment CreateDefaultDelegateSelfAssessment( DescriptionLabel = descriptionLabel, IsAssignedToSupervisor = isAssignedToSupervisor, NonReportable = nonReportable, - IsSupervisorResultsReviewed= isSupervisorResultsReviewed, + IsSupervisorResultsReviewed = isSupervisorResultsReviewed, RoleName = roleName, SupervisorRoleTitle = supervisorRoleTitle, - + }; } diff --git a/DigitalLearningSolutions.Web/Controllers/SupervisorController/Supervisor.cs b/DigitalLearningSolutions.Web/Controllers/SupervisorController/Supervisor.cs index 8a42ac8f73..1fa34ac3e8 100644 --- a/DigitalLearningSolutions.Web/Controllers/SupervisorController/Supervisor.cs +++ b/DigitalLearningSolutions.Web/Controllers/SupervisorController/Supervisor.cs @@ -384,14 +384,14 @@ public IActionResult ReviewDelegateSelfAssessment(int supervisorDelegateId, int IsSupervisorResultsReviewed = delegateSelfAssessment.IsSupervisorResultsReviewed, SearchViewModel = searchModel, CandidateAssessmentId = candidateAssessmentId, - ExportToExcelHide = delegateSelfAssessment.SupervisorRoleTitle?.Contains("Assessor") ?? false, + ExportToExcelHide = delegateSelfAssessment.SupervisorRoleTitle?.Contains("Nominated Supervisor") ?? false, }; var flags = frameworkService.GetSelectedCompetencyFlagsByCompetecyIds(reviewedCompetencies.Select(c => c.Id).ToArray()); foreach (var competency in competencies) { competency.CompetencyFlags = flags.Where(f => f.CompetencyId == competency.Id); - }; + } if (superviseDelegate.DelegateUserID != null) { @@ -1093,7 +1093,11 @@ public IActionResult QuickAddSupervisor(int selfAssessmentId, int supervisorDele { var candidateAssessmentId = selfAssessmentService.GetCandidateAssessments(delegateUserId, selfAssessmentId).SingleOrDefault()?.Id; - var roleId = supervisorRoles.Where(x => x.SelfAssessmentID == selfAssessmentId).Select(x => x.ID).FirstOrDefault(); + //var roleId = supervisorRoles.Where(x => x.SelfAssessmentID == selfAssessmentId).Select(x => x.ID).FirstOrDefault(); + var roleId = supervisorRoles + .Where(x => supervisorRoles.Any(y => y.SelfAssessmentID == selfAssessmentId) ? x.SelfAssessmentID == selfAssessmentId : x.SelfAssessmentID == null) + .Select(x => x.ID) + .FirstOrDefault(); if (candidateAssessmentId != null) { var candidateAssessmentSupervisor = supervisorService.GetCandidateAssessmentSupervisor((int)candidateAssessmentId, supervisorDelegateId, roleId); diff --git a/DigitalLearningSolutions.Web/Views/LearningPortal/SelfAssessments/_SelfAssessmentCertificateSecondPage.cshtml b/DigitalLearningSolutions.Web/Views/LearningPortal/SelfAssessments/_SelfAssessmentCertificateSecondPage.cshtml index 2d91b24e83..062b348d09 100644 --- a/DigitalLearningSolutions.Web/Views/LearningPortal/SelfAssessments/_SelfAssessmentCertificateSecondPage.cshtml +++ b/DigitalLearningSolutions.Web/Views/LearningPortal/SelfAssessments/_SelfAssessmentCertificateSecondPage.cshtml @@ -23,12 +23,12 @@

-

Responses confirmed by assessor

+

Responses confirmed by nominated supervisor

@Model.ConfirmedResponses

-

Assessors

    +

    Nominated supervisors

      @foreach (var accessor in Model.Accessors) {

      diff --git a/DigitalLearningSolutions.Web/Views/Supervisor/Shared/_DelegateProfileAssessmentGrid.cshtml b/DigitalLearningSolutions.Web/Views/Supervisor/Shared/_DelegateProfileAssessmentGrid.cshtml index d638ca4ac8..67d99a3e9f 100644 --- a/DigitalLearningSolutions.Web/Views/Supervisor/Shared/_DelegateProfileAssessmentGrid.cshtml +++ b/DigitalLearningSolutions.Web/Views/Supervisor/Shared/_DelegateProfileAssessmentGrid.cshtml @@ -75,7 +75,7 @@ { Remove } - @if (delegateSelfAssessment.CompletedDate == null && delegateSelfAssessment.LaunchCount != 0 && delegateSelfAssessment.SupervisorRoleTitle == "Educator/Manager") + @if (delegateSelfAssessment.CompletedDate == null && delegateSelfAssessment.LaunchCount != 0 && delegateSelfAssessment.SupervisorRoleTitle == "Supervisor") { Stop supervising diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/Shared/_DelegateSelfAssessmentDetails.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/Shared/_DelegateSelfAssessmentDetails.cshtml index a5376e461d..98dbb79848 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/Shared/_DelegateSelfAssessmentDetails.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/Shared/_DelegateSelfAssessmentDetails.cshtml @@ -49,8 +49,7 @@

      @{ var supervisors = string.Join(", ", new[] { - new { Role = "Educator/Manager", Count = Model.Supervisors.Count(x => x.RoleName == "Educator/Manager") }, - new { Role = "Assessor", Count = Model.Supervisors.Count(x => x.RoleName == "Assessor") }, + new { Role = "Nominated Supervisor", Count = Model.Supervisors.Count(x => x.RoleName == "Nominated Supervisor") }, new { Role = "Supervisor", Count = Model.Supervisors.Count(x => x.RoleName == "Supervisor") } } .Where(x => x.Count > 0) From 9aa1d4fac7a029f30e0cabd3981447ecef3ac048 Mon Sep 17 00:00:00 2001 From: Auldrin-Possa Date: Mon, 22 Sep 2025 08:47:31 +0100 Subject: [PATCH 2/2] TD-5638-Added DB snapshot --- ...dminTitlesAddSupervisorNominatedSupervisor.cs | 11 +++++++++-- .../Properties/Resources.Designer.cs | 16 ++++++++++++++++ .../Properties/Resources.resx | 3 +++ .../Scripts/TD-5638-SnapshotData-UP.sql | 10 ++++++++++ 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 DigitalLearningSolutions.Data.Migrations/Scripts/TD-5638-SnapshotData-UP.sql diff --git a/DigitalLearningSolutions.Data.Migrations/202508261415_RemoveCustomAdminTitlesAddSupervisorNominatedSupervisor.cs b/DigitalLearningSolutions.Data.Migrations/202508261415_RemoveCustomAdminTitlesAddSupervisorNominatedSupervisor.cs index 2610dd1a75..a55908dc6b 100644 --- a/DigitalLearningSolutions.Data.Migrations/202508261415_RemoveCustomAdminTitlesAddSupervisorNominatedSupervisor.cs +++ b/DigitalLearningSolutions.Data.Migrations/202508261415_RemoveCustomAdminTitlesAddSupervisorNominatedSupervisor.cs @@ -2,11 +2,13 @@ { using FluentMigrator; - [Migration(202508261415)] - public class RemoveCustomAdminTitlesAddSupervisorNominatedSupervisor : ForwardOnlyMigration + [Migration(202508261415, TransactionBehavior.None)] + public class RemoveCustomAdminTitlesAddSupervisorNominatedSupervisor : Migration { public override void Up() { + Execute.Sql(Properties.Resources.TD_5638_SnapshotData_UP); + Execute.Sql($@" -- 1. Drop old FK ALTER TABLE [dbo].[SelfAssessmentSupervisorRoles] @@ -59,5 +61,10 @@ LEFT JOIN SelfAssessmentSupervisorRoles nom " ); } + + public override void Down() + { + // Intentionally empty. If things go wrong later, we will manually restore the snapshot + } } } diff --git a/DigitalLearningSolutions.Data.Migrations/Properties/Resources.Designer.cs b/DigitalLearningSolutions.Data.Migrations/Properties/Resources.Designer.cs index f07492a60b..9695f84a64 100644 --- a/DigitalLearningSolutions.Data.Migrations/Properties/Resources.Designer.cs +++ b/DigitalLearningSolutions.Data.Migrations/Properties/Resources.Designer.cs @@ -2660,6 +2660,22 @@ internal static string TD_5638_Alter_GetCandidateAssessmentResultsById_Up { } } + /// + /// Looks up a localized string similar to DECLARE @dbName NVARCHAR(128) = DB_NAME() + ///DECLARE @defaultPath NVARCHAR(500) = CONVERT(NVARCHAR(500), SERVERPROPERTY('InstanceDefaultDataPath')) + ///DECLARE @snapshotTime NVARCHAR(12) = FORMAT(GETDATE(), 'yyyyMMddHHmm') + /// + ///DECLARE @snapSql NVARCHAR(4000) = 'CREATE DATABASE ' + @dbName + '_' + @snapshotTime + ' ON + ///( NAME = mbdbx101, FILENAME = ''' + @defaultPath + @dbName + '_' + @snapshotTime + '''), + ///( NAME = mbdbx101files, FILENAME = ''' + @defaultPath + @dbName + '_filestream1_' + @snapshotTime + ''') + ///A [rest of string was truncated]";. + /// + internal static string TD_5638_SnapshotData_UP { + get { + return ResourceManager.GetString("TD_5638_SnapshotData_UP", resourceCulture); + } + } + /// /// Looks up a localized string similar to IF OBJECT_ID('dbo.IndexOptimize', 'P') IS NOT NULL DROP PROCEDURE dbo.IndexOptimize; ///IF OBJECT_ID('dbo.CommandExecute', 'P') IS NOT NULL DROP PROCEDURE dbo.CommandExecute; diff --git a/DigitalLearningSolutions.Data.Migrations/Properties/Resources.resx b/DigitalLearningSolutions.Data.Migrations/Properties/Resources.resx index 418da257f0..9b57c0b2cf 100644 --- a/DigitalLearningSolutions.Data.Migrations/Properties/Resources.resx +++ b/DigitalLearningSolutions.Data.Migrations/Properties/Resources.resx @@ -517,4 +517,7 @@ ..\Scripts\TD-5638-Alter_GetCandidateAssessmentResultsById_Up.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16 + + ..\Scripts\TD-5638-SnapshotData-UP.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + \ No newline at end of file diff --git a/DigitalLearningSolutions.Data.Migrations/Scripts/TD-5638-SnapshotData-UP.sql b/DigitalLearningSolutions.Data.Migrations/Scripts/TD-5638-SnapshotData-UP.sql new file mode 100644 index 0000000000..f56ddef6d9 --- /dev/null +++ b/DigitalLearningSolutions.Data.Migrations/Scripts/TD-5638-SnapshotData-UP.sql @@ -0,0 +1,10 @@ +DECLARE @dbName NVARCHAR(128) = DB_NAME() +DECLARE @defaultPath NVARCHAR(500) = CONVERT(NVARCHAR(500), SERVERPROPERTY('InstanceDefaultDataPath')) +DECLARE @snapshotTime NVARCHAR(12) = FORMAT(GETDATE(), 'yyyyMMddHHmm') + +DECLARE @snapSql NVARCHAR(4000) = 'CREATE DATABASE ' + @dbName + '_' + @snapshotTime + ' ON +( NAME = mbdbx101, FILENAME = ''' + @defaultPath + @dbName + '_' + @snapshotTime + '''), +( NAME = mbdbx101files, FILENAME = ''' + @defaultPath + @dbName + '_filestream1_' + @snapshotTime + ''') +AS SNAPSHOT OF ' + @dbName + +EXEC sp_executesql @stmt = @SnapSql