Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
-- 02-Sep-2025 SA Incorrect Syntax
-- 23-09-2025 SA Added new columns for displaying video/Audio Progress
-- 01-10-2025 SA added assesment score and passmark and provider details
-- 16-12-2025 SA TD-6322 added the condition to validate the certificate enabled is true for the latest resourceversion.
-------------------------------------------------------------------------------
CREATE PROCEDURE [activity].[GetUserRecentLearningActivities] (
@userId INT,
Expand Down Expand Up @@ -34,7 +35,8 @@ BEGIN
r.ResourceTypeId AS ResourceType,
rv.Title AS Title,
--rv.[Description] AS ResourceDescription,
rv.CertificateEnabled AS CertificateEnabled,
-- Get CertificateEnabled from the latest resource version
rvCurrent.CertificateEnabled AS CertificateEnabled,
ISNULL(ara.ActivityStatusId, ra.ActivityStatusId) AS ActivityStatus,
ra.ActivityStart AS ActivityDate,
-- ara.ActivityEnd,
Expand All @@ -59,7 +61,10 @@ BEGIN
FROM activity.ResourceActivity ra
LEFT JOIN activity.ResourceActivity ara ON ara.LaunchResourceActivityId = ra.Id
INNER JOIN [resources].[Resource] r ON ra.ResourceId = r.Id
INNER JOIN [resources].[ResourceVersion] rv ON rv.Id = ra.ResourceVersionId AND rv.Deleted = 0
-- Version used in the activity
INNER JOIN [resources].[ResourceVersion] rv ON rv.Id = ra.ResourceVersionId AND rv.Deleted = 0
-- Latest resource version
INNER JOIN [resources].[ResourceVersion] rvCurrent ON rvCurrent.Id = r.CurrentResourceVersionId
LEFT JOIN (
SELECT
rp.ResourceVersionId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
-- Modification History
-- 23-09-2025 SA Added new columns for displaying video/Audio Progress
-- 01-10-2025 SA added assesment score and passmark and provider details
-- 16-12-2025 SA TD-6322 added the condition to validate the certificate enabled is true for the latest resourceversion.
-------------------------------------------------------------------------------
CREATE PROCEDURE [activity].[GetUsersLearningHistory] (
@userId INT,
Expand All @@ -31,7 +32,8 @@ BEGIN
ra.NodePathId AS NodePathId,
r.ResourceTypeId AS ResourceType,
rv.Title AS Title,
rv.CertificateEnabled AS CertificateEnabled,
-- Get CertificateEnabled from the latest resource version
rvCurrent.CertificateEnabled AS CertificateEnabled,
ISNULL(ara.ActivityStatusId, ra.ActivityStatusId) AS ActivityStatus,
ra.ActivityStart AS ActivityDate,
ISNULL(ara.DurationSeconds, 0) ActivityDurationSeconds,
Expand All @@ -50,7 +52,10 @@ BEGIN
LEFT JOIN activity.ResourceActivity ara
ON ara.LaunchResourceActivityId = ra.Id
INNER JOIN [resources].[Resource] r ON ra.ResourceId = r.Id
INNER JOIN [resources].[ResourceVersion] rv ON rv.Id = ra.ResourceVersionId AND rv.deleted =0
-- Version used in the activity
INNER JOIN [resources].[ResourceVersion] rv ON rv.Id = ra.ResourceVersionId AND rv.Deleted = 0
-- Latest resource version
INNER JOIN [resources].[ResourceVersion] rvCurrent ON rvCurrent.Id = r.CurrentResourceVersionId
LEFT JOIN (
SELECT
rp.ResourceVersionId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
-- Modification History
-- 23-09-2025 SA Added new columns for displaying video/Audio Progress
-- 01-10-2025 SA added assesment score and passmark and provider details
-- 16-12-2025 SA TD-6322 added the condition to validate the certificate enabled is true for the latest resourceversion.
-------------------------------------------------------------------------------
CREATE PROCEDURE [activity].[GetUsersLearningHistory_Search] (
@userId INT,
Expand Down Expand Up @@ -34,7 +35,8 @@ BEGIN
ra.NodePathId AS NodePathId,
r.ResourceTypeId AS ResourceType,
rv.Title AS Title,
rv.CertificateEnabled AS CertificateEnabled,
-- Get CertificateEnabled from the latest resource version
rvCurrent.CertificateEnabled AS CertificateEnabled,
ISNULL(ara.ActivityStatusId, ra.ActivityStatusId) AS ActivityStatus,
ra.ActivityStart AS ActivityDate,
ISNULL(ara.DurationSeconds, 0) AS ActivityDurationSeconds,
Expand All @@ -53,7 +55,10 @@ BEGIN
LEFT JOIN activity.ResourceActivity ara
ON ara.LaunchResourceActivityId = ra.Id
INNER JOIN [resources].[Resource] r ON ra.ResourceId = r.Id
INNER JOIN [resources].[ResourceVersion] rv ON rv.Id = ra.ResourceVersionId AND rv.deleted =0
-- Version used in the activity
INNER JOIN [resources].[ResourceVersion] rv ON rv.Id = ra.ResourceVersionId AND rv.Deleted = 0
-- Latest resource version
INNER JOIN [resources].[ResourceVersion] rvCurrent ON rvCurrent.Id = r.CurrentResourceVersionId
LEFT JOIN (
SELECT
rp.ResourceVersionId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
-- 16-09-2025 Tobi Added null check for ResourceReferenceID
--17-09-2025 Swapna Added resource version id
-- 01-10-2025 SA added assesment score and passmark and provider details
-- 16=12-2025 SA TD-6322 added the condition to validate the certificate enabled is true for the latest resourceversion.
-------------------------------------------------------------------------------
CREATE PROCEDURE [resources].[GetUsercertificateDetails]
@UserId INT,
Expand All @@ -26,18 +27,32 @@ BEGIN
ResourceActivityId INT NOT NULL,
PRIMARY KEY CLUSTERED (ResourceActivityId)
);

-- to get the latest resourceVersion
;WITH LatestResourceVersion AS (
SELECT
rv.ResourceId,
rv.Id AS ResourceVersionId,
rv.CertificateEnabled
FROM resources.ResourceVersion rv
WHERE rv.Deleted = 0
AND rv.Id = (
SELECT MAX(rv2.Id)
FROM resources.ResourceVersion rv2
WHERE rv2.ResourceId = rv.ResourceId
AND rv2.Deleted = 0
)
)
INSERT INTO #MyActivity (ResourceId, ResourceActivityId)
SELECT
ra.ResourceId,
MAX(ra.Id) AS ResourceActivityId
FROM activity.ResourceActivity ra
JOIN resources.Resource r
ON ra.ResourceId = r.Id
JOIN resources.ResourceVersion rv
ON rv.Id = ra.ResourceVersionId
JOIN LatestResourceVersion lrv
ON lrv.ResourceId = ra.ResourceId
WHERE ra.UserId = @UserId
AND rv.CertificateEnabled = 1
AND lrv.CertificateEnabled = 1
AND (
(r.ResourceTypeId IN (2, 7) AND ra.ActivityStatusId = 3)
OR (ra.ActivityStart < '2020-09-07T00:00:00+00:00')
Expand Down
Loading