Skip to content

Commit ef7d2ef

Browse files
TD-3671 using the function and store procedure of the UAT DB for the down migration of the PR
1 parent d53f28b commit ef7d2ef

6 files changed

+59
-92
lines changed

DigitalLearningSolutions.Data.Migrations/202405031044_AlterGetCurrentCoursesForCandidate_V2.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public override void Up()
1212
}
1313
public override void Down()
1414
{
15-
Execute.Sql(Properties.Resources.TD_3671_Alter_GetCurrentCoursesForCandidate_V2_proc1_down);
15+
Execute.Sql(Properties.Resources.TD_3671_Alter_GetCurrentCoursesForCandidate_V2_proc_down);
1616
Execute.Sql(Properties.Resources.TD_3671_Alter_CheckDelegateStatusForCustomisation_func_down);
1717
}
1818
}

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

Lines changed: 34 additions & 31 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: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -379,13 +379,13 @@
379379
<data name="TD_3671_Alter_CheckDelegateStatusForCustomisation_func_up" type="System.Resources.ResXFileRef, System.Windows.Forms">
380380
<value>..\Resources\TD_3671_Alter_CheckDelegateStatusForCustomisation_func_up.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
381381
</data>
382-
<data name="TD_3671_Alter_CheckDelegateStatusForCustomisation_func_down" type="System.Resources.ResXFileRef, System.Windows.Forms">
383-
<value>..\Resources\TD-3671-Alter_CheckDelegateStatusForCustomisation_func_down.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
384-
</data>
385382
<data name="TD_3671_Alter_GetCurrentCoursesForCandidate_V2_proc1_up" type="System.Resources.ResXFileRef, System.Windows.Forms">
386383
<value>..\Resources\TD-3671-Alter_GetCurrentCoursesForCandidate_V2_proc1_up.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
387384
</data>
388-
<data name="TD_3671_Alter_GetCurrentCoursesForCandidate_V2_proc1_down" type="System.Resources.ResXFileRef, System.Windows.Forms">
389-
<value>..\Resources\TD_3671_Alter_GetCurrentCoursesForCandidate_V2_proc1_down.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
385+
<data name="TD_3671_Alter_CheckDelegateStatusForCustomisation_func_down" type="System.Resources.ResXFileRef, System.Windows.Forms">
386+
<value>..\Resources\TD_3671_Alter_CheckDelegateStatusForCustomisation_func_down.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
387+
</data>
388+
<data name="TD_3671_Alter_GetCurrentCoursesForCandidate_V2_proc_down" type="System.Resources.ResXFileRef, System.Windows.Forms">
389+
<value>..\Resources\TD-3671-Alter_GetCurrentCoursesForCandidate_V2_proc_down.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
390390
</data>
391391
</root>

DigitalLearningSolutions.Data.Migrations/Resources/TD-3671-Alter_GetCurrentCoursesForCandidate_V2_proc_down.sql

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
2-
/****** Object: StoredProcedure [dbo].[GetCurrentCoursesForCandidate_V2] Script Date: 08/05/2024 10:34:29 ******/
1+
/****** Object: StoredProcedure [dbo].[GetCurrentCoursesForCandidate_V2] Script Date: 16/05/2024 09:37:05 ******/
32
SET ANSI_NULLS ON
43
GO
4+
55
SET QUOTED_IDENTIFIER ON
66
GO
7+
78
-- =============================================
89
-- Author: Kevin Whittaker
910
-- Create date: 16/12/2016
@@ -18,7 +19,7 @@ BEGIN
1819
-- SET NOCOUNT ON added to prevent extra result sets from
1920
-- interfering with SELECT statements.
2021
SET NOCOUNT ON;
21-
22+
2223
-- Insert statements for procedure here
2324
SELECT p.ProgressID, (CASE WHEN cu.CustomisationName <> '' THEN a.ApplicationName + ' - ' + cu.CustomisationName ELSE a.ApplicationName END) AS CourseName, p.CustomisationID, p.SubmittedTime AS LastAccessed,
2425
p.FirstSubmittedTime AS StartedDate, p.DiagnosticScore, p.PLLocked, cu.IsAssessed, dbo.CheckCustomisationSectionHasDiagnostic(p.CustomisationID, 0)
@@ -33,10 +34,12 @@ BEGIN
3334
FROM Sections AS s
3435
WHERE (ApplicationID = cu.ApplicationID)) AS Sections, p.CompleteByDate, CAST(CASE WHEN p.CompleteByDate IS NULL THEN 0 WHEN p.CompleteByDate < getDate()
3536
THEN 2 WHEN p.CompleteByDate < DATEADD(M, + 1, getDate()) THEN 1 ELSE 0 END AS INT) AS OverDue, p.EnrollmentMethodID, dbo.GetCohortGroupCustomisationID(p.ProgressID) AS GroupCustomisationID, p.SupervisorAdminID
36-
37+
3738
FROM Progress AS p INNER JOIN
3839
Customisations AS cu ON p.CustomisationID = cu.CustomisationID INNER JOIN
3940
Applications AS a ON cu.ApplicationID = a.ApplicationID
40-
WHERE (p.Completed IS NULL) AND (p.RemovedDate IS NULL) AND (p.CandidateID = @CandidateID)AND (cu.CustomisationName <> 'ESR') AND (a.ArchivedDate IS NULL) AND (cu.Active = 1) AND ((p.SubmittedTime > DATEADD(M, -6, getDate())) OR NOT p.CompleteByDate IS NULL)
41+
WHERE (p.Completed IS NULL) AND (p.RemovedDate IS NULL) AND (p.CandidateID = @CandidateID)AND (cu.CustomisationName <> 'ESR') AND (a.ArchivedDate IS NULL) AND (cu.Active = 1) AND (p.SubmittedTime > DATEADD(M, -6, getDate()) OR NOT p.CompleteByDate IS NULL)
4142
ORDER BY p.SubmittedTime Desc
42-
END
43+
END
44+
GO
45+
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
/****** Object: UserDefinedFunction [dbo].[CheckDelegateStatusForCustomisation] Script Date: 08/05/2024 11:27:59 ******/
1+
/****** Object: UserDefinedFunction [dbo].[CheckDelegateStatusForCustomisation] Script Date: 16/05/2024 09:29:31 ******/
22
SET ANSI_NULLS ON
33
GO
4+
45
SET QUOTED_IDENTIFIER ON
56
GO
7+
68
-- =============================================
79
-- Author: Kevin Whittaker
810
-- Create date: 22/12/2016
@@ -27,13 +29,12 @@ BEGIN
2729
-- Declare the return variable here
2830
DECLARE @ResultVar int
2931
Set @ResultVar = 0
30-
32+
3133
-- Add the T-SQL statements to compute the return value here
32-
3334
-- Check of current:
3435
if @CustomisationID IN (SELECT CustomisationID
3536
FROM Progress AS p
36-
WHERE (Completed IS NULL) AND (RemovedDate IS NULL) AND (CandidateID = @CandidateID) AND ((SubmittedTime > DATEADD(M, - 6, GETDATE())) OR NOT p.CompleteByDate IS NULL))
37+
WHERE (Completed IS NULL) AND (RemovedDate IS NULL) AND (CandidateID = @CandidateID) AND (SubmittedTime > DATEADD(M, - 6, GETDATE()) OR NOT p.CompleteByDate IS NULL))
3738
begin
3839
Set @ResultVar = 3
3940
goto onExit
@@ -49,7 +50,7 @@ end
4950
--Check if Expired:
5051
if @CustomisationID IN (SELECT CustomisationID
5152
FROM Progress AS p
52-
WHERE (Completed IS NULL) AND (RemovedDate IS NULL) AND (CandidateID = @CandidateID) AND ((SubmittedTime <= DATEADD(M, - 6, GETDATE()))) AND (p.CompleteByDate IS NULL))
53+
WHERE (Completed IS NULL) AND (RemovedDate IS NULL) AND (CandidateID = @CandidateID) AND (SubmittedTime <= DATEADD(M, - 6, GETDATE())) AND (p.CompleteByDate IS NULL))
5354
begin
5455
Set @ResultVar = 1
5556
goto onExit
@@ -65,6 +66,8 @@ end
6566
-- Return the result of the function
6667
onExit:
6768
RETURN @ResultVar
68-
69+
6970
END
70-
71+
72+
GO
73+

DigitalLearningSolutions.Data.Migrations/Resources/TD_3671_Alter_GetCurrentCoursesForCandidate_V2_proc1_down.sql

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)