Skip to content

Commit 882a811

Browse files
TD-4243 Few 'add on' courses showing on 'Learning Portal' not showing on 'Course set up' & 'Delegate activities' screens
1 parent 8dcea75 commit 882a811

File tree

5 files changed

+167
-1
lines changed

5 files changed

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

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

Lines changed: 47 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: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,4 +406,10 @@
406406
<data name="TD_4223_Alter_GroupCustomisation_Add_V2_Up" type="System.Resources.ResXFileRef, System.Windows.Forms">
407407
<value>..\Scripts\TD-4223-Alter_GroupCustomisation_Add_V2_Up.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
408408
</data>
409-
</root>
409+
<data name="TD_4243_Alter_GetCurrentCoursesForCandidate_V2_proc_down" type="System.Resources.ResXFileRef, System.Windows.Forms">
410+
<value>..\Resources\TD-4243_Alter_GetCurrentCoursesForCandidate_V2_proc_down.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
411+
</data>
412+
<data name="TD_4243_Alter_GetCurrentCoursesForCandidate_V2_proc_up" type="System.Resources.ResXFileRef, System.Windows.Forms">
413+
<value>..\Resources\TD-4243_Alter_GetCurrentCoursesForCandidate_V2_proc_up.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
414+
</data>
415+
</root>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
/****** Object: StoredProcedure [dbo].[GetCurrentCoursesForCandidate_V2] Script Date: 22/07/2024 10:11:35 ******/
3+
SET ANSI_NULLS ON
4+
GO
5+
6+
SET QUOTED_IDENTIFIER ON
7+
GO
8+
9+
-- =============================================
10+
-- Author: Kevin Whittaker
11+
-- Create date: 16/12/2016
12+
-- Description: Returns a list of active progress records for the candidate.
13+
-- Change 18/09/2018: Adds logic to exclude Removed courses from returned results.
14+
-- =============================================
15+
ALTER PROCEDURE [dbo].[GetCurrentCoursesForCandidate_V2]
16+
-- Add the parameters for the stored procedure here
17+
@CandidateID int
18+
AS
19+
BEGIN
20+
-- SET NOCOUNT ON added to prevent extra result sets from
21+
-- interfering with SELECT statements.
22+
SET NOCOUNT ON;
23+
24+
-- Insert statements for procedure here
25+
SELECT p.ProgressID, (CASE WHEN cu.CustomisationName <> '' THEN a.ApplicationName + ' - ' + cu.CustomisationName ELSE a.ApplicationName END) AS CourseName, p.CustomisationID, p.SubmittedTime AS LastAccessed,
26+
p.FirstSubmittedTime AS StartedDate, p.DiagnosticScore, p.PLLocked, cu.IsAssessed, dbo.CheckCustomisationSectionHasDiagnostic(p.CustomisationID, 0)
27+
AS HasDiagnostic, dbo.CheckCustomisationSectionHasLearning(p.CustomisationID, 0) AS HasLearning,
28+
COALESCE
29+
((SELECT COUNT(Passes) AS Passes
30+
FROM (SELECT COUNT(AssessAttemptID) AS Passes
31+
FROM AssessAttempts AS aa
32+
WHERE (CandidateID = p.CandidateID) AND (CustomisationID = p.CustomisationID) AND (Status = 1)
33+
GROUP BY SectionNumber) AS derivedtbl_2), 0) AS Passes,
34+
(SELECT COUNT(SectionID) AS Sections
35+
FROM Sections AS s
36+
WHERE (ApplicationID = cu.ApplicationID)) AS Sections, p.CompleteByDate, CAST(CASE WHEN p.CompleteByDate IS NULL THEN 0 WHEN p.CompleteByDate < getDate()
37+
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
38+
39+
FROM Progress AS p INNER JOIN
40+
Customisations AS cu ON p.CustomisationID = cu.CustomisationID INNER JOIN
41+
Applications AS a ON cu.ApplicationID = a.ApplicationID
42+
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
43+
((p.SubmittedTime > DATEADD(M, -6, getDate()) OR (EnrollmentMethodID <> 1)) OR NOT (p.CompleteByDate IS NULL) AND NOT
44+
(p.SubmittedTime < DATEADD(MONTH, -6, GETDATE()) AND (p.EnrollmentMethodID = 1) AND (p.CompleteByDate < GETDATE())))
45+
ORDER BY p.SubmittedTime Desc
46+
END
47+
GO
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
3+
/****** Object: StoredProcedure [dbo].[GetCurrentCoursesForCandidate_V2] Script Date: 22/07/2024 10:11:35 ******/
4+
SET ANSI_NULLS ON
5+
GO
6+
7+
SET QUOTED_IDENTIFIER ON
8+
GO
9+
10+
-- =============================================
11+
-- Author: Kevin Whittaker
12+
-- Create date: 16/12/2016
13+
-- Description: Returns a list of active progress records for the candidate.
14+
-- Change 18/09/2018: Adds logic to exclude Removed courses from returned results.
15+
-- =============================================
16+
ALTER PROCEDURE [dbo].[GetCurrentCoursesForCandidate_V2]
17+
-- Add the parameters for the stored procedure here
18+
@CandidateID int
19+
AS
20+
BEGIN
21+
-- SET NOCOUNT ON added to prevent extra result sets from
22+
-- interfering with SELECT statements.
23+
SET NOCOUNT ON;
24+
25+
-- Insert statements for procedure here
26+
SELECT p.ProgressID, (CASE WHEN cu.CustomisationName <> '' THEN a.ApplicationName + ' - ' + cu.CustomisationName ELSE a.ApplicationName END) AS CourseName, p.CustomisationID, p.SubmittedTime AS LastAccessed,
27+
p.FirstSubmittedTime AS StartedDate, p.DiagnosticScore, p.PLLocked, cu.IsAssessed, dbo.CheckCustomisationSectionHasDiagnostic(p.CustomisationID, 0)
28+
AS HasDiagnostic, dbo.CheckCustomisationSectionHasLearning(p.CustomisationID, 0) AS HasLearning,
29+
COALESCE
30+
((SELECT COUNT(Passes) AS Passes
31+
FROM (SELECT COUNT(AssessAttemptID) AS Passes
32+
FROM AssessAttempts AS aa
33+
WHERE (CandidateID = p.CandidateID) AND (CustomisationID = p.CustomisationID) AND (Status = 1)
34+
GROUP BY SectionNumber) AS derivedtbl_2), 0) AS Passes,
35+
(SELECT COUNT(SectionID) AS Sections
36+
FROM Sections AS s
37+
WHERE (ApplicationID = cu.ApplicationID)) AS Sections, p.CompleteByDate, CAST(CASE WHEN p.CompleteByDate IS NULL THEN 0 WHEN p.CompleteByDate < getDate()
38+
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
39+
40+
FROM Progress AS p INNER JOIN
41+
Customisations AS cu ON p.CustomisationID = cu.CustomisationID INNER JOIN
42+
Applications AS a ON cu.ApplicationID = a.ApplicationID INNER JOIN
43+
CentreApplications AS ca ON ca.ApplicationID = a.ApplicationID AND ca.CentreID = cu.CentreID
44+
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
45+
((p.SubmittedTime > DATEADD(M, -6, getDate()) OR (EnrollmentMethodID <> 1)) OR NOT (p.CompleteByDate IS NULL) AND NOT
46+
(p.SubmittedTime < DATEADD(MONTH, -6, GETDATE()) AND (p.EnrollmentMethodID = 1) AND (p.CompleteByDate < GETDATE())))
47+
ORDER BY p.SubmittedTime Desc
48+
END
49+
GO

0 commit comments

Comments
 (0)