Skip to content

Commit 673ab7f

Browse files
committed
Merge branch 'master' into DLS-Release-v1.2.4
2 parents 589f7df + 89847cd commit 673ab7f

File tree

31 files changed

+978
-520
lines changed

31 files changed

+978
-520
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
namespace DigitalLearningSolutions.Data.Migrations
2+
{
3+
using FluentMigrator;
4+
[Migration(202508191440)]
5+
public class CreateSendRetiringSelfAssessmentNotificationSP : Migration
6+
{
7+
public override void Up()
8+
{
9+
string generalTELTeam =
10+
@"[
11+
{ ""FirstName"":"""", ""LastName"":"""", ""Email"":""[email protected]"" },
12+
{ ""FirstName"":""Anna"", ""LastName"":""Athanasopoulou"", ""Email"":""[email protected]"" },
13+
{ ""FirstName"":""Benjamin"", ""LastName"":""Witton"", ""Email"":""[email protected]"" }
14+
]";
15+
16+
Execute.Sql(@$"IF NOT EXISTS (SELECT ConfigID FROM Config WHERE ConfigName = 'GeneralTELTeam')
17+
BEGIN
18+
INSERT INTO Config VALUES ('GeneralTELTeam', '{generalTELTeam}', 0,GETDATE(), GETDATE())
19+
END"
20+
);
21+
22+
Execute.Sql(Properties.Resources.TD_5552_SendRetiringNotification);
23+
}
24+
public override void Down()
25+
{
26+
Execute.Sql(@"DELETE FROM Config WHERE ConfigName = N'GeneralTELTeam'");
27+
28+
Execute.Sql("DROP PROCEDURE [dbo].[SendRetiringSelfAssessmentNotification]");
29+
}
30+
}
31+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+

2+
3+
namespace DigitalLearningSolutions.Data.Migrations
4+
{
5+
using FluentMigrator;
6+
7+
[Migration(202509180915)]
8+
public class Alter_SendRetiringSelfAssessmentNotification : Migration
9+
{
10+
public override void Up()
11+
{
12+
Execute.Sql(Properties.Resources.TD_5552_Alter_SendRetiringSelfAssessmentNotification_Up);
13+
}
14+
public override void Down()
15+
{
16+
Execute.Sql(Properties.Resources.TD_5552_Alter_SendRetiringSelfAssessmentNotification_Down);
17+
}
18+
}
19+
}

DigitalLearningSolutions.Data.Migrations/Properties/Resources.Designer.cs

Lines changed: 62 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

DigitalLearningSolutions.Data.Migrations/Properties/Resources.resx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,4 +520,13 @@
520520
<data name="TD_5638_SnapshotData_UP" type="System.Resources.ResXFileRef, System.Windows.Forms">
521521
<value>..\Scripts\TD-5638-SnapshotData-UP.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
522522
</data>
523+
<data name="TD_5552_SendRetiringNotification" type="System.Resources.ResXFileRef, System.Windows.Forms">
524+
<value>..\Scripts\TD-5552-SendRetiringNotification.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
525+
</data>
526+
<data name="TD_5552_Alter_SendRetiringSelfAssessmentNotification_Down" type="System.Resources.ResXFileRef, System.Windows.Forms">
527+
<value>..\Scripts\TD-5552-Alter_SendRetiringSelfAssessmentNotification_Down.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
528+
</data>
529+
<data name="TD_5552_Alter_SendRetiringSelfAssessmentNotification_Up" type="System.Resources.ResXFileRef, System.Windows.Forms">
530+
<value>..\Scripts\TD-5552-Alter_SendRetiringSelfAssessmentNotification_Up.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
531+
</data>
523532
</root>
Binary file not shown.

DigitalLearningSolutions.Data/DataServices/SelfAssessmentDataService/CandidateAssessmentsDataService.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ public void SetSubmittedDateNow(int selfAssessmentId, int delegateUserId)
430430
public void RemoveEnrolment(int selfAssessmentId, int delegateUserId)
431431
{
432432
connection.Execute(
433-
@"UPDATE CandidateAssessments SET RemovedDate = GETDATE()
433+
@"UPDATE CandidateAssessments SET RemovedDate = GETDATE(), SelfAssessmentProcessAgreed = NULL
434434
WHERE SelfAssessmentID = @selfAssessmentId AND DelegateUserID = @delegateUserId",
435435
new { selfAssessmentId, delegateUserId }
436436
);
@@ -520,11 +520,13 @@ public IEnumerable<Accessor> GetAccessor(int selfAssessmentId, int delegateUserI
520520
{
521521
return connection.Query<Accessor>(
522522
@"SELECT CASE WHEN AccessorPRN IS NOT NULL THEN AccessorName+', '+AccessorPRN ELSE AccessorName END AS AccessorList,AccessorName,AccessorPRN
523-
FROM (SELECT COALESCE(au.Forename + ' ' + au.Surname + (CASE WHEN au.Active = 1 THEN '' ELSE ' (Inactive)' END), sd.SupervisorEmail) AS AccessorName,
523+
FROM (SELECT DISTINCT COALESCE(au.Forename + ' ' + au.Surname + (CASE WHEN au.Active = 1 THEN '' ELSE ' (Inactive)' END), sd.SupervisorEmail) AS AccessorName,
524524
u.ProfessionalRegistrationNumber AS AccessorPRN
525525
FROM SupervisorDelegates AS sd
526526
INNER JOIN CandidateAssessmentSupervisors AS cas
527527
ON sd.ID = cas.SupervisorDelegateId
528+
INNER JOIN SelfAssessmentResultSupervisorVerifications AS srsv
529+
ON cas.ID = srsv.CandidateAssessmentSupervisorID
528530
INNER JOIN CandidateAssessments AS ca
529531
ON cas.CandidateAssessmentID = ca.ID
530532
LEFT OUTER JOIN AdminUsers AS au
@@ -534,7 +536,8 @@ LEFT OUTER JOIN SelfAssessmentSupervisorRoles AS sasr
534536
ON cas.SelfAssessmentSupervisorRoleID = sasr.ID
535537
INNER JOIN Users AS u ON U.PrimaryEmail = au.Email
536538
WHERE
537-
(sd.Removed IS NULL) AND (cas.Removed IS NULL) AND (ca.DelegateUserID = @DelegateUserID) AND (ca.SelfAssessmentID = @selfAssessmentId)) Accessor
539+
(ca.DelegateUserID = @DelegateUserID) AND (ca.SelfAssessmentID = @selfAssessmentId)
540+
AND (srsv.Verified IS NOT NULL)) Accessor
538541
ORDER BY AccessorName, AccessorPRN DESC",
539542
new { selfAssessmentId, delegateUserID }
540543
);

DigitalLearningSolutions.Data/DataServices/SelfAssessmentDataService/SelfAssessmentDataService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,8 @@ public void RemoveDelegateSelfAssessment(int candidateAssessmentsId)
745745
connection.Execute(
746746
@"BEGIN TRY
747747
BEGIN TRANSACTION
748-
UPDATE CandidateAssessments SET RemovedDate = GETUTCDATE(), RemovalMethodID = 2
748+
UPDATE CandidateAssessments SET RemovedDate = GETUTCDATE(), RemovalMethodID = 2,
749+
SelfAssessmentProcessAgreed = NULL
749750
WHERE ID = @candidateAssessmentsId AND RemovedDate IS NULL
750751
751752
COMMIT TRANSACTION

DigitalLearningSolutions.Data/DataServices/SupervisorDataService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,8 @@ public bool RemoveCandidateAssessment(int candidateAssessmentId)
10051005
@"
10061006
BEGIN TRY
10071007
BEGIN TRANSACTION
1008-
UPDATE CandidateAssessments SET RemovedDate = getUTCDate(), RemovalMethodID = 2
1008+
UPDATE CandidateAssessments SET RemovedDate = getUTCDate(), RemovalMethodID = 2,
1009+
SelfAssessmentProcessAgreed = NULL
10091010
WHERE ID = @candidateAssessmentId AND RemovedDate IS NULL
10101011
10111012
COMMIT TRANSACTION

0 commit comments

Comments
 (0)