Skip to content

Commit 335495b

Browse files
authored
Merge pull request #2797 from TechnologyEnhancedLearning/Develop/Fixes/TD-4243-Few'addon'coursesshowingon'LearningPortal'notshowingon'Coursesetup&Delegateactivitiesscreensfix
TD-4243 Few 'add on' courses showing on 'Learning Portal' not showing…
2 parents d82983b + b10beb2 commit 335495b

File tree

11 files changed

+360
-3
lines changed

11 files changed

+360
-3
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+

2+
3+
namespace DigitalLearningSolutions.Data.Migrations
4+
{
5+
using FluentMigrator;
6+
7+
[Migration(202408271645)]
8+
public class AlterAvailableandCompletedCoursesForDelegate : Migration
9+
{
10+
public override void Up()
11+
{
12+
Execute.Sql(Properties.Resources.TD_4243_Alter_GetActivitiesForDelegateEnrolment_proc_up);
13+
Execute.Sql(Properties.Resources.TD_4243_Alter_GetCompletedCoursesForCandidate_proc_up);
14+
}
15+
public override void Down()
16+
{
17+
Execute.Sql(Properties.Resources.TD_4243_Alter_GetActivitiesForDelegateEnrolment_proc_down);
18+
Execute.Sql(Properties.Resources.TD_4243_Alter_GetCompletedCoursesForCandidate_proc_down);
19+
}
20+
}
21+
}

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

Lines changed: 88 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: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,18 @@
418418
<data name="TD_4436_Alter_uspCreateProgressRecord_V3_Up" type="System.Resources.ResXFileRef, System.Windows.Forms">
419419
<value>..\Scripts\TD-4436-Alter_uspCreateProgressRecord_V3_Up.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
420420
</data>
421+
<data name="TD_4243_Alter_GetActivitiesForDelegateEnrolment_proc_down" type="System.Resources.ResXFileRef, System.Windows.Forms">
422+
<value>..\Resources\TD-4243_Alter_GetActivitiesForDelegateEnrolment_proc_down.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
423+
</data>
424+
<data name="TD_4243_Alter_GetActivitiesForDelegateEnrolment_proc_up" type="System.Resources.ResXFileRef, System.Windows.Forms">
425+
<value>..\Resources\TD-4243_Alter_GetActivitiesForDelegateEnrolment_proc_up.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
426+
</data>
427+
<data name="TD_4243_Alter_GetCompletedCoursesForCandidate_proc_down" type="System.Resources.ResXFileRef, System.Windows.Forms">
428+
<value>..\Resources\TD-4243_Alter_GetCompletedCoursesForCandidate_proc_down.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
429+
</data>
430+
<data name="TD_4243_Alter_GetCompletedCoursesForCandidate_proc_up" type="System.Resources.ResXFileRef, System.Windows.Forms">
431+
<value>..\Resources\TD-4243_Alter_GetCompletedCoursesForCandidate_proc_up.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
432+
</data>
421433
<data name="TD_4436_Alter_GroupCustomisation_Add_V2_UpdateCompleteBy_Supervisor_Down" type="System.Resources.ResXFileRef, System.Windows.Forms">
422434
<value>..\Scripts\TD-4436-Alter_GroupCustomisation_Add_V2_UpdateCompleteBy_Supervisor_Down.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
423435
</data>
@@ -430,4 +442,4 @@
430442
<data name="TD_4436_Alter_uspCreateProgressRecordWithCompleteWithinMonths_Quiet_V2_Up" type="System.Resources.ResXFileRef, System.Windows.Forms">
431443
<value>..\Scripts\TD-4436-Alter_uspCreateProgressRecordWithCompleteWithinMonths_Quiet_V2_Up.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
432444
</data>
433-
</root>
445+
</root>
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
2+
/****** Object: StoredProcedure [dbo].[GetActivitiesForDelegateEnrolment] Script Date: 20/08/2024 11:57:38 ******/
3+
SET ANSI_NULLS ON
4+
GO
5+
6+
SET QUOTED_IDENTIFIER ON
7+
GO
8+
9+
-- =============================================
10+
-- Author: Kevin Whittaker
11+
-- Create date: 24/01/2023
12+
-- Description: Returns active available for delegate enrolment based on original GetActiveAvailableCustomisationsForCentreFiltered_V6 sproc but adjusted for user account refactor and filters properly for category.
13+
-- =============================================
14+
ALTER PROCEDURE [dbo].[GetActivitiesForDelegateEnrolment]
15+
-- Add the parameters for the stored procedure here
16+
@CentreID as Int = 0,
17+
@DelegateID as int,
18+
@CategoryId as Int = 0
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+
SELECT * FROM
25+
-- Insert statements for procedure here
26+
(SELECT cu.CustomisationID, cu.Active, cu.CurrentVersion, cu.CentreID, cu.ApplicationID, (CASE WHEN cu.CustomisationName <> '' THEN a.ApplicationName + ' - ' + cu.CustomisationName ELSE a.ApplicationName END) AS CourseName, cu.CustomisationText, 0 AS IncludesSignposting, 0 AS IsSelfAssessment, cu.SelfRegister AS SelfRegister,
27+
cu.IsAssessed, dbo.CheckCustomisationSectionHasDiagnostic(cu.CustomisationID, 0) AS HasDiagnostic,
28+
dbo.CheckCustomisationSectionHasLearning(cu.CustomisationID, 0) AS HasLearning, (SELECT BrandName FROM Brands WHERE BrandID = a.BrandID) AS Brand, (SELECT CategoryName FROM CourseCategories WHERE CourseCategoryID = a.CourseCategoryID) AS Category, (SELECT CourseTopic FROM CourseTopics WHERE CourseTopicID = a.CourseTopicID) AS Topic, dbo.CheckDelegateStatusForCustomisation(cu.CustomisationID, @DelegateID) AS DelegateStatus,
29+
cu.HideInLearnerPortal
30+
FROM Customisations AS cu INNER JOIN
31+
Applications AS a
32+
ON cu.ApplicationID = a.ApplicationID
33+
WHERE ((cu.CentreID = @CentreID) OR (cu.AllCentres = 1 AND (EXISTS(SELECT CentreApplicationID FROM CentreApplications WHERE ApplicationID = a.ApplicationID AND CentreID = @CentreID AND Active = 1)))) AND
34+
(cu.Active = 1) AND
35+
(a.ASPMenu = 1) AND
36+
(a.ArchivedDate IS NULL) AND
37+
(dbo.CheckDelegateStatusForCustomisation(cu.CustomisationID, @DelegateID) IN (0,1,4)) AND
38+
(cu.CustomisationName <> 'ESR') AND
39+
(a.CourseCategoryID = @CategoryId OR @CategoryId =0)
40+
UNION ALL
41+
SELECT SA.ID AS CustomisationID, 1 AS Active, 1 AS CurrentVersion, CSA.CentreID as CentreID, 0 AS ApplicationID, SA.Name AS CourseName, SA.Description AS CustomisationText, SA.IncludesSignposting, 1 AS IsSelfAssessment, CSA.AllowEnrolment AS SelfRegister, 0 AS IsAssessed, 0 AS HasDiagnostic, 0 AS HasLearning,
42+
(SELECT BrandName
43+
FROM Brands
44+
WHERE (BrandID = SA.BrandID)) AS Brand,
45+
(SELECT CategoryName
46+
FROM CourseCategories
47+
WHERE (CourseCategoryID = SA.CategoryID)) AS Category,
48+
'' AS Topic, IIF(CA.RemovedDate IS NULL,0,1) AS DelegateStatus,
49+
0 AS HideInLearnerPortal
50+
FROM SelfAssessments AS SA
51+
INNER JOIN CentreSelfAssessments AS CSA ON SA.Id = CSA.SelfAssessmentID AND CSA.CentreId = @centreId
52+
LEFT JOIN CandidateAssessments AS CA ON CSA.SelfAssessmentID=CA.SelfAssessmentID AND CA.DelegateUserID = (SELECT UserID from DelegateAccounts where ID=@DelegateID)
53+
WHERE (SA.ID NOT IN
54+
(SELECT SelfAssessmentID
55+
FROM CandidateAssessments AS CA
56+
INNER JOIN Users AS U ON CA.DelegateUserID = U.ID
57+
INNER JOIN DelegateAccounts AS DA ON U.ID = DA.UserID
58+
WHERE (DA.ID = @DelegateID) AND (CA.RemovedDate IS NULL) AND (CA.CompletedDate IS NULL))) AND
59+
(SA.CategoryID = @CategoryId OR @CategoryId =0)
60+
)
61+
AS Q1
62+
ORDER BY Q1.CourseName
63+
END
64+
GO
65+
66+
67+
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
2+
/****** Object: StoredProcedure [dbo].[GetActivitiesForDelegateEnrolment] Script Date: 20/08/2024 11:57:38 ******/
3+
SET ANSI_NULLS ON
4+
GO
5+
6+
SET QUOTED_IDENTIFIER ON
7+
GO
8+
9+
-- =============================================
10+
-- Author: Kevin Whittaker
11+
-- Create date: 24/01/2023
12+
-- Description: Returns active available for delegate enrolment based on original GetActiveAvailableCustomisationsForCentreFiltered_V6 sproc but adjusted for user account refactor and filters properly for category.
13+
-- =============================================
14+
ALTER PROCEDURE [dbo].[GetActivitiesForDelegateEnrolment]
15+
-- Add the parameters for the stored procedure here
16+
@CentreID as Int = 0,
17+
@DelegateID as int,
18+
@CategoryId as Int = 0
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+
SELECT * FROM
25+
-- Insert statements for procedure here
26+
(SELECT cu.CustomisationID, cu.Active, cu.CurrentVersion, cu.CentreID, cu.ApplicationID, (CASE WHEN cu.CustomisationName <> '' THEN a.ApplicationName + ' - ' + cu.CustomisationName ELSE a.ApplicationName END) AS CourseName, cu.CustomisationText, 0 AS IncludesSignposting, 0 AS IsSelfAssessment, cu.SelfRegister AS SelfRegister,
27+
cu.IsAssessed, dbo.CheckCustomisationSectionHasDiagnostic(cu.CustomisationID, 0) AS HasDiagnostic,
28+
dbo.CheckCustomisationSectionHasLearning(cu.CustomisationID, 0) AS HasLearning, (SELECT BrandName FROM Brands WHERE BrandID = a.BrandID) AS Brand, (SELECT CategoryName FROM CourseCategories WHERE CourseCategoryID = a.CourseCategoryID) AS Category, (SELECT CourseTopic FROM CourseTopics WHERE CourseTopicID = a.CourseTopicID) AS Topic, dbo.CheckDelegateStatusForCustomisation(cu.CustomisationID, @DelegateID) AS DelegateStatus,
29+
cu.HideInLearnerPortal
30+
FROM Customisations AS cu INNER JOIN
31+
Applications AS a
32+
ON cu.ApplicationID = a.ApplicationID INNER JOIN
33+
CentreApplications AS ca ON ca.ApplicationID = a.ApplicationID AND ca.CentreID = cu.CentreID
34+
WHERE ((cu.CentreID = @CentreID) OR (cu.AllCentres = 1 AND (EXISTS(SELECT CentreApplicationID FROM CentreApplications WHERE ApplicationID = a.ApplicationID AND CentreID = @CentreID AND Active = 1)))) AND
35+
(cu.Active = 1) AND
36+
(a.ASPMenu = 1) AND
37+
(a.ArchivedDate IS NULL) AND
38+
(dbo.CheckDelegateStatusForCustomisation(cu.CustomisationID, @DelegateID) IN (0,1,4)) AND
39+
(cu.CustomisationName <> 'ESR') AND
40+
(a.CourseCategoryID = @CategoryId OR @CategoryId =0)
41+
UNION ALL
42+
SELECT SA.ID AS CustomisationID, 1 AS Active, 1 AS CurrentVersion, CSA.CentreID as CentreID, 0 AS ApplicationID, SA.Name AS CourseName, SA.Description AS CustomisationText, SA.IncludesSignposting, 1 AS IsSelfAssessment, CSA.AllowEnrolment AS SelfRegister, 0 AS IsAssessed, 0 AS HasDiagnostic, 0 AS HasLearning,
43+
(SELECT BrandName
44+
FROM Brands
45+
WHERE (BrandID = SA.BrandID)) AS Brand,
46+
(SELECT CategoryName
47+
FROM CourseCategories
48+
WHERE (CourseCategoryID = SA.CategoryID)) AS Category,
49+
'' AS Topic, IIF(CA.RemovedDate IS NULL,0,1) AS DelegateStatus,
50+
0 AS HideInLearnerPortal
51+
FROM SelfAssessments AS SA
52+
INNER JOIN CentreSelfAssessments AS CSA ON SA.Id = CSA.SelfAssessmentID AND CSA.CentreId = @centreId
53+
LEFT JOIN CandidateAssessments AS CA ON CSA.SelfAssessmentID=CA.SelfAssessmentID AND CA.DelegateUserID = (SELECT UserID from DelegateAccounts where ID=@DelegateID)
54+
WHERE (SA.ID NOT IN
55+
(SELECT SelfAssessmentID
56+
FROM CandidateAssessments AS CA
57+
INNER JOIN Users AS U ON CA.DelegateUserID = U.ID
58+
INNER JOIN DelegateAccounts AS DA ON U.ID = DA.UserID
59+
WHERE (DA.ID = @DelegateID) AND (CA.RemovedDate IS NULL) AND (CA.CompletedDate IS NULL))) AND
60+
(SA.CategoryID = @CategoryId OR @CategoryId =0)
61+
)
62+
AS Q1
63+
ORDER BY Q1.CourseName
64+
END
65+
GO
66+
67+
68+
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
/****** Object: StoredProcedure [dbo].[GetCompletedCoursesForCandidate] Script Date: 20/08/2024 11:58:45 ******/
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 completed courses for the candidate.
13+
-- 21/06/2021: Adds Applications.ArchivedDate field to output.
14+
-- =============================================
15+
ALTER PROCEDURE [dbo].[GetCompletedCoursesForCandidate]
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, p.Completed,
26+
p.FirstSubmittedTime AS StartedDate, p.RemovedDate, 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.Evaluated, p.FollupUpEvaluated, a.ArchivedDate
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 (NOT (p.Completed IS NULL)) AND (p.CandidateID = @CandidateID)
41+
ORDER BY p.Completed DESC
42+
43+
END
44+
GO
45+
46+
47+

0 commit comments

Comments
 (0)