Skip to content

Commit d53f28b

Browse files
TD-3671 Removing the added bracket for the activities store procedure
1 parent 283d2eb commit d53f28b

File tree

4 files changed

+50
-8
lines changed

4 files changed

+50
-8
lines changed

DigitalLearningSolutions.Data.Migrations/202405031044_AlterGetCurrentCoursesForCandidate_V2.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
using FluentMigrator;
44

5-
[Migration(202405151044)]
5+
[Migration(202405161044)]
66
public class AlterGetCurrentCoursesForCandidate_V2 : Migration
77
{
88
public override void Up()
@@ -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_proc_down);
15+
Execute.Sql(Properties.Resources.TD_3671_Alter_GetCurrentCoursesForCandidate_V2_proc1_down);
1616
Execute.Sql(Properties.Resources.TD_3671_Alter_CheckDelegateStatusForCustomisation_func_down);
1717
}
1818
}

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

Lines changed: 2 additions & 2 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: 4 additions & 4 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_GetCurrentCoursesForCandidate_V2_proc_down" type="System.Resources.ResXFileRef, System.Windows.Forms">
383-
<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>
384-
</data>
385382
<data name="TD_3671_Alter_CheckDelegateStatusForCustomisation_func_down" type="System.Resources.ResXFileRef, System.Windows.Forms">
386383
<value>..\Resources\TD-3671-Alter_CheckDelegateStatusForCustomisation_func_down.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
387384
</data>
388385
<data name="TD_3671_Alter_GetCurrentCoursesForCandidate_V2_proc1_up" type="System.Resources.ResXFileRef, System.Windows.Forms">
389386
<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>
390387
</data>
391-
</root>
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>
390+
</data>
391+
</root>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
/****** Object: StoredProcedure [dbo].[GetCurrentCoursesForCandidate_V2] Script Date: 08/05/2024 10:34:29 ******/
3+
SET ANSI_NULLS ON
4+
GO
5+
SET QUOTED_IDENTIFIER ON
6+
GO
7+
-- =============================================
8+
-- Author: Kevin Whittaker
9+
-- Create date: 16/12/2016
10+
-- Description: Returns a list of active progress records for the candidate.
11+
-- Change 18/09/2018: Adds logic to exclude Removed courses from returned results.
12+
-- =============================================
13+
ALTER PROCEDURE [dbo].[GetCurrentCoursesForCandidate_V2]
14+
-- Add the parameters for the stored procedure here
15+
@CandidateID int
16+
AS
17+
BEGIN
18+
-- SET NOCOUNT ON added to prevent extra result sets from
19+
-- interfering with SELECT statements.
20+
SET NOCOUNT ON;
21+
22+
-- Insert statements for procedure here
23+
SELECT p.ProgressID, (CASE WHEN cu.CustomisationName <> '' THEN a.ApplicationName + ' - ' + cu.CustomisationName ELSE a.ApplicationName END) AS CourseName, p.CustomisationID, p.SubmittedTime AS LastAccessed,
24+
p.FirstSubmittedTime AS StartedDate, p.DiagnosticScore, p.PLLocked, cu.IsAssessed, dbo.CheckCustomisationSectionHasDiagnostic(p.CustomisationID, 0)
25+
AS HasDiagnostic, dbo.CheckCustomisationSectionHasLearning(p.CustomisationID, 0) AS HasLearning,
26+
COALESCE
27+
((SELECT COUNT(Passes) AS Passes
28+
FROM (SELECT COUNT(AssessAttemptID) AS Passes
29+
FROM AssessAttempts AS aa
30+
WHERE (CandidateID = p.CandidateID) AND (CustomisationID = p.CustomisationID) AND (Status = 1)
31+
GROUP BY SectionNumber) AS derivedtbl_2), 0) AS Passes,
32+
(SELECT COUNT(SectionID) AS Sections
33+
FROM Sections AS s
34+
WHERE (ApplicationID = cu.ApplicationID)) AS Sections, p.CompleteByDate, CAST(CASE WHEN p.CompleteByDate IS NULL THEN 0 WHEN p.CompleteByDate < getDate()
35+
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+
FROM Progress AS p INNER JOIN
38+
Customisations AS cu ON p.CustomisationID = cu.CustomisationID INNER JOIN
39+
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+
ORDER BY p.SubmittedTime Desc
42+
END

0 commit comments

Comments
 (0)