Skip to content

Commit 3b50338

Browse files
committed
Merge branch 'Release-2024.29-Hotfix' into Release-2024.32
2 parents 0fbbe4c + e4bcd8e commit 3b50338

9 files changed

+148
-6
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
namespace DigitalLearningSolutions.Data.Migrations
2+
{
3+
using FluentMigrator;
4+
5+
[Migration(202406270900)]
6+
public class Alter_uspCreateProgressRecord_V3 : Migration
7+
{
8+
public override void Up()
9+
{
10+
Execute.Sql(Properties.Resources.TD_4223_Alter_uspCreateProgressRecord_V3_Up);
11+
Execute.Sql(Properties.Resources.TD_4223_Alter_uspCreateProgressRecordWithCompleteWithinMonths_Quiet_V2_Up);
12+
}
13+
public override void Down()
14+
{
15+
Execute.Sql(Properties.Resources.TD_4223_Alter_uspCreateProgressRecord_V3_Down);
16+
Execute.Sql(Properties.Resources.TD_4223_Alter_uspCreateProgressRecordWithCompleteWithinMonths_Quiet_V2_Down);
17+
}
18+
}
19+
}

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

Lines changed: 92 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: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,4 +388,18 @@
388388
<data name="TD_3671_Alter_GetCurrentCoursesForCandidate_V2_proc_up" type="System.Resources.ResXFileRef, System.Windows.Forms">
389389
<value>..\Resources\TD-3671-Alter_GetCurrentCoursesForCandidate_V2_proc_up.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
390390
</data>
391-
</root>
391+
392+
<data name="TD_4223_Alter_uspCreateProgressRecord_V3_Down" type="System.Resources.ResXFileRef, System.Windows.Forms">
393+
<value>..\Scripts\TD-4223-Alter_uspCreateProgressRecord_V3_Down.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
394+
</data>
395+
<data name="TD_4223_Alter_uspCreateProgressRecord_V3_Up" type="System.Resources.ResXFileRef, System.Windows.Forms">
396+
<value>..\Scripts\TD-4223-Alter_uspCreateProgressRecord_V3_Up.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
397+
</data>
398+
399+
<data name="TD_4223_Alter_uspCreateProgressRecordWithCompleteWithinMonths_Quiet_V2_Down" type="System.Resources.ResXFileRef, System.Windows.Forms">
400+
<value>..\Scripts\TD-4223-Alter_uspCreateProgressRecordWithCompleteWithinMonths_Quiet_V2_Down.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
401+
</data>
402+
<data name="TD_4223_Alter_uspCreateProgressRecordWithCompleteWithinMonths_Quiet_V2_Up" type="System.Resources.ResXFileRef, System.Windows.Forms">
403+
<value>..\Scripts\TD-4223-Alter_uspCreateProgressRecordWithCompleteWithinMonths_Quiet_V2_Up.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
404+
</data>
405+
</root>
Binary file not shown.

DigitalLearningSolutions.Data/DataServices/CourseDataService.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ public int EnrolOnActivitySelfAssessment(int selfAssessmentId, int candidateId,
437437
DateTime startedDate = clockUtility.UtcNow;
438438
DateTime? lastAccessed = null;
439439
dynamic? completeByDateDynamic = null;
440-
int enrolmentMethodId = 2;
440+
int enrolmentMethodId = (int)EnrolmentMethod.AdminOrSupervisor;
441441
if (completeByDate == null || completeByDate.GetValueOrDefault().Year > 1753)
442442
{
443443
completeByDateDynamic = completeByDate!;
@@ -527,7 +527,7 @@ LEFT OUTER JOIN UserCentreDetails AS UCD ON
527527
{
528528
string sqlQuery = $@"
529529
BEGIN TRANSACTION
530-
UPDATE CandidateAssessments SET RemovedDate = NULL
530+
UPDATE CandidateAssessments SET RemovedDate = NULL, EnrolmentMethodId = @enrolmentMethodId
531531
WHERE ID = @candidateAssessmentId
532532
533533
UPDATE CandidateAssessmentSupervisors SET Removed = NULL
@@ -537,7 +537,7 @@ BEGIN TRANSACTION
537537
COMMIT TRANSACTION";
538538

539539
connection.Execute(sqlQuery
540-
, new { candidateAssessmentId, selfAssessmentSupervisorRoleId });
540+
, new { candidateAssessmentId, selfAssessmentSupervisorRoleId, enrolmentMethodId });
541541
}
542542

543543
if (candidateAssessmentId < 1)
@@ -553,6 +553,7 @@ BEGIN TRANSACTION
553553

554554
public void EnrolOnSelfAssessment(int selfAssessmentId, int delegateUserId, int centreId)
555555
{
556+
int enrolmentMethodId = (int)EnrolmentMethod.Self;
556557
var enrolmentExists = Convert.ToInt32(connection.ExecuteScalar(
557558
@"SELECT COALESCE
558559
((SELECT ID
@@ -574,9 +575,9 @@ FROM CandidateAssessments
574575
{
575576
connection.Execute(
576577
@"UPDATE CandidateAssessments
577-
SET RemovedDate = NULL
578+
SET RemovedDate = NULL, EnrolmentMethodId = @enrolmentMethodId
578579
WHERE ID = @enrolmentExists",
579-
new { enrolmentExists }
580+
new { enrolmentExists, enrolmentMethodId }
580581
);
581582
}
582583
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace DigitalLearningSolutions.Data.Enums
8+
{
9+
public enum EnrolmentMethod
10+
{
11+
Self = 1,
12+
AdminOrSupervisor,
13+
Group,
14+
System
15+
}
16+
}

0 commit comments

Comments
 (0)