diff --git a/AdminUI/LearningHub.Nhs.AdminUI/LearningHub.Nhs.AdminUI.csproj b/AdminUI/LearningHub.Nhs.AdminUI/LearningHub.Nhs.AdminUI.csproj index 455a59ce..8f2ec6fd 100644 --- a/AdminUI/LearningHub.Nhs.AdminUI/LearningHub.Nhs.AdminUI.csproj +++ b/AdminUI/LearningHub.Nhs.AdminUI/LearningHub.Nhs.AdminUI.csproj @@ -89,7 +89,7 @@ - + diff --git a/LearningHub.Nhs.WebUI.AutomatedUiTests/LearningHub.Nhs.WebUI.AutomatedUiTests.csproj b/LearningHub.Nhs.WebUI.AutomatedUiTests/LearningHub.Nhs.WebUI.AutomatedUiTests.csproj index 1d14b5d7..05546fe6 100644 --- a/LearningHub.Nhs.WebUI.AutomatedUiTests/LearningHub.Nhs.WebUI.AutomatedUiTests.csproj +++ b/LearningHub.Nhs.WebUI.AutomatedUiTests/LearningHub.Nhs.WebUI.AutomatedUiTests.csproj @@ -13,7 +13,7 @@ - + diff --git a/LearningHub.Nhs.WebUI/Helpers/ViewActivityHelper.cs b/LearningHub.Nhs.WebUI/Helpers/ViewActivityHelper.cs index 739af4e8..f3b8d107 100644 --- a/LearningHub.Nhs.WebUI/Helpers/ViewActivityHelper.cs +++ b/LearningHub.Nhs.WebUI/Helpers/ViewActivityHelper.cs @@ -2,6 +2,7 @@ { using System; using System.Collections.Generic; + using System.Diagnostics; using System.Linq; using LearningHub.Nhs.Models.Enums; using LearningHub.Nhs.Models.MyLearning; @@ -405,6 +406,21 @@ public static bool CanViewProgress(this ActivityDetailedItemViewModel activityDe return false; } + /// + /// CanView Video Progress. + /// + /// The MyLearningCombinedActivitiesViewModel. + /// The bool. + public static bool CanViewVidoProgress(this MyLearningCombinedActivitiesViewModel activitiesViewModel) + { + if ((activitiesViewModel.ResourceType == ResourceTypeEnum.Video || activitiesViewModel.ResourceType == ResourceTypeEnum.Audio) && activitiesViewModel.ActivityStatus == ActivityStatusEnum.Incomplete && activitiesViewModel.IsCurrentResourceVersion && activitiesViewModel.IsMostRecent) + { + return true; + } + + return false; + } + /// /// GetDurationText. /// diff --git a/LearningHub.Nhs.WebUI/LearningHub.Nhs.WebUI.csproj b/LearningHub.Nhs.WebUI/LearningHub.Nhs.WebUI.csproj index 9a2e4649..1c811190 100644 --- a/LearningHub.Nhs.WebUI/LearningHub.Nhs.WebUI.csproj +++ b/LearningHub.Nhs.WebUI/LearningHub.Nhs.WebUI.csproj @@ -113,7 +113,7 @@ - + diff --git a/LearningHub.Nhs.WebUI/Views/MyLearning/LearningHistory.cshtml b/LearningHub.Nhs.WebUI/Views/MyLearning/LearningHistory.cshtml index 5f9e7dee..9a22769c 100644 --- a/LearningHub.Nhs.WebUI/Views/MyLearning/LearningHistory.cshtml +++ b/LearningHub.Nhs.WebUI/Views/MyLearning/LearningHistory.cshtml @@ -223,6 +223,13 @@
} + else @if (ViewActivityHelper.CanViewVidoProgress(activity)) + { +
+ @activity.CompletionPercentage% complete + View Progress +
+ } @if (ViewActivityHelper.CanCertificateawarded(activity)) diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Models/LearningHub.Nhs.OpenApi.Models.csproj b/OpenAPI/LearningHub.Nhs.OpenApi.Models/LearningHub.Nhs.OpenApi.Models.csproj index 83e3cde9..aa36c6c2 100644 --- a/OpenAPI/LearningHub.Nhs.OpenApi.Models/LearningHub.Nhs.OpenApi.Models.csproj +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Models/LearningHub.Nhs.OpenApi.Models.csproj @@ -16,7 +16,7 @@ - + diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/LearningHub.Nhs.OpenApi.Repositories.Interface.csproj b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/LearningHub.Nhs.OpenApi.Repositories.Interface.csproj index 11b41e3b..b4aa7139 100644 --- a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/LearningHub.Nhs.OpenApi.Repositories.Interface.csproj +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/LearningHub.Nhs.OpenApi.Repositories.Interface.csproj @@ -17,7 +17,7 @@ - + diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories/LearningHub.Nhs.OpenApi.Repositories.csproj b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories/LearningHub.Nhs.OpenApi.Repositories.csproj index aa35fb6f..4bf27d7b 100644 --- a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories/LearningHub.Nhs.OpenApi.Repositories.csproj +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories/LearningHub.Nhs.OpenApi.Repositories.csproj @@ -24,7 +24,7 @@ - + diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Services.Interface/LearningHub.Nhs.OpenApi.Services.Interface.csproj b/OpenAPI/LearningHub.Nhs.OpenApi.Services.Interface/LearningHub.Nhs.OpenApi.Services.Interface.csproj index c762aa8f..94e8c268 100644 --- a/OpenAPI/LearningHub.Nhs.OpenApi.Services.Interface/LearningHub.Nhs.OpenApi.Services.Interface.csproj +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Services.Interface/LearningHub.Nhs.OpenApi.Services.Interface.csproj @@ -17,7 +17,7 @@ - + diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Services/LearningHub.Nhs.OpenApi.Services.csproj b/OpenAPI/LearningHub.Nhs.OpenApi.Services/LearningHub.Nhs.OpenApi.Services.csproj index 66e6969c..c0802359 100644 --- a/OpenAPI/LearningHub.Nhs.OpenApi.Services/LearningHub.Nhs.OpenApi.Services.csproj +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Services/LearningHub.Nhs.OpenApi.Services.csproj @@ -30,7 +30,7 @@ - + diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Services/Services/DashboardService.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Services/Services/DashboardService.cs index c3bd9c4b..fda7e14c 100644 --- a/OpenAPI/LearningHub.Nhs.OpenApi.Services/Services/DashboardService.cs +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Services/Services/DashboardService.cs @@ -234,6 +234,9 @@ public async Task GetMyInprogressLearning ScorePercentage = Activity.ScorePercentage, TotalActivities = 0, CompletedActivities = 0, + IsMostRecent = false, + ResourceDurationMilliseconds = Activity.ResourceDurationMilliseconds, + CompletionPercentage = Activity.CompletionPercentage, }).ToList(); } @@ -258,6 +261,9 @@ public async Task GetMyInprogressLearning ScorePercentage = Convert.ToInt32(course.ProgressPercentage.TrimEnd('%')), TotalActivities = course.TotalActivities, CompletedActivities = course.CompletedActivities, + IsMostRecent = false, + ResourceDurationMilliseconds = 0, + CompletionPercentage = 0, }).ToList(); } diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Services/Services/MyLearningService.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Services/Services/MyLearningService.cs index 0f476fde..29a28a9c 100644 --- a/OpenAPI/LearningHub.Nhs.OpenApi.Services/Services/MyLearningService.cs +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Services/Services/MyLearningService.cs @@ -185,6 +185,9 @@ public async Task GetUserRecentMyLearning ScorePercentage = Activity.ScorePercentage, TotalActivities = 0, CompletedActivities = 0, + IsMostRecent = false, + ResourceDurationMilliseconds = Activity.ResourceDurationMilliseconds, + CompletionPercentage = Activity.CompletionPercentage, }).ToList(); } @@ -209,11 +212,14 @@ public async Task GetUserRecentMyLearning ScorePercentage = Convert.ToInt32(course.ProgressPercentage.TrimEnd('%')), TotalActivities = course.TotalActivities, CompletedActivities = course.CompletedActivities, + IsMostRecent = false, + ResourceDurationMilliseconds = 0, + CompletionPercentage=0, }).ToList(); } // Combine both result sets - combainedUserActivities = mappedMyLearningActivities.Concat(mappedEnrolledCourses).ToList(); + combainedUserActivities = mappedMyLearningActivities.Concat(mappedEnrolledCourses).ToList(); var pagedResults = combainedUserActivities.OrderByDescending(activity => activity.ActivityDate).Skip(requestModel.Skip).Take(requestModel.Take).ToList(); @@ -272,6 +278,13 @@ public async Task GetUserLearningHistoryA if (result != null) { + // Step 1: Get most recent date per ResourceId + var mostRecentByResource = result + .GroupBy(a => a.ResourceId) + .ToDictionary( + g => g.Key, + g => g.Max(a => a.ActivityDate) + ); mappedMyLearningActivities = result.Select(activity => new MyLearningCombinedActivitiesViewModel { UserId = userId, @@ -289,6 +302,12 @@ public async Task GetUserLearningHistoryA ScorePercentage = activity.ScorePercentage, TotalActivities = 0, CompletedActivities = 0, + + //Set IsMostRecent if this is the most recent activity for the ResourceId + IsMostRecent = mostRecentByResource.TryGetValue(activity.ResourceId, out var mostRecentDate) + && activity.ActivityDate == mostRecentDate, + ResourceDurationMilliseconds = activity.ResourceDurationMilliseconds, + CompletionPercentage = activity.CompletionPercentage, }).ToList(); } @@ -324,6 +343,9 @@ public async Task GetUserLearningHistoryA ScorePercentage = int.TryParse(course.ProgressPercentage.TrimEnd('%'), out var score) ? score : 0, TotalActivities = course.TotalActivities, CompletedActivities = course.CompletedActivities, + IsMostRecent = false, + ResourceDurationMilliseconds = 0, + CompletionPercentage = 0, }).ToList(); } } @@ -399,8 +421,8 @@ public async Task> GetResourceCertif if (assessmentType == AssessmentTypeEnum.Formal) { - activityEntities = activityEntities.Where(x => x.AssessmentResourceActivity.FirstOrDefault() != null && - x.AssessmentResourceActivity.First().Score.HasValue && + activityEntities = activityEntities.Where(x => x.AssessmentResourceActivity.FirstOrDefault() != null && + x.AssessmentResourceActivity.First().Score.HasValue && (int)Math.Round(x.AssessmentResourceActivity.First().Score.Value, MidpointRounding.AwayFromZero) >= x.ResourceVersion.AssessmentResourceVersion.PassMark) .ToList(); @@ -501,7 +523,6 @@ public async Task> PopulateMyLearningDetai latestActivityCheck.RemoveAll(x => x.Resource.ResourceTypeEnum == ResourceTypeEnum.Scorm && (x.ActivityStatusId == (int)ActivityStatusEnum.Downloaded || x.ActivityStatusId == (int)ActivityStatusEnum.Incomplete || x.ActivityStatusId == (int)ActivityStatusEnum.InProgress)); if (latestActivityCheck.Any() && latestActivityCheck.FirstOrDefault()?.Resource.ResourceTypeEnum == ResourceTypeEnum.Assessment) { - latestActivityCheck = latestActivityCheck.Where(x => x.AssessmentResourceActivity.FirstOrDefault() != null && (x.ResourceVersion.AssessmentResourceVersion.AssessmentType == AssessmentTypeEnum.Formal && x.AssessmentResourceActivity.FirstOrDefault() != null && x.AssessmentResourceActivity.First().Score.HasValue && (int)Math.Round(x.AssessmentResourceActivity.First().Score.Value, MidpointRounding.AwayFromZero) >= x.ResourceVersion.AssessmentResourceVersion.PassMark) || (x.ResourceVersion.AssessmentResourceVersion.AssessmentType == AssessmentTypeEnum.Informal && x.AssessmentResourceActivity.FirstOrDefault() != null && x.AssessmentResourceActivity.First().Score.HasValue)).ToList(); } diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Tests/LearningHub.Nhs.OpenApi.Tests.csproj b/OpenAPI/LearningHub.Nhs.OpenApi.Tests/LearningHub.Nhs.OpenApi.Tests.csproj index e1700349..e90cddaf 100644 --- a/OpenAPI/LearningHub.Nhs.OpenApi.Tests/LearningHub.Nhs.OpenApi.Tests.csproj +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Tests/LearningHub.Nhs.OpenApi.Tests.csproj @@ -11,7 +11,7 @@ - + diff --git a/OpenAPI/LearningHub.Nhs.OpenApi/LearningHub.NHS.OpenAPI.csproj b/OpenAPI/LearningHub.Nhs.OpenApi/LearningHub.NHS.OpenAPI.csproj index 6d8e0f65..35e4eba3 100644 --- a/OpenAPI/LearningHub.Nhs.OpenApi/LearningHub.NHS.OpenAPI.csproj +++ b/OpenAPI/LearningHub.Nhs.OpenApi/LearningHub.NHS.OpenAPI.csproj @@ -19,7 +19,7 @@ - + diff --git a/ReportAPI/LearningHub.Nhs.ReportApi.Services.Interface/LearningHub.Nhs.ReportApi.Services.Interface.csproj b/ReportAPI/LearningHub.Nhs.ReportApi.Services.Interface/LearningHub.Nhs.ReportApi.Services.Interface.csproj index 0d5bfb32..b947f5d0 100644 --- a/ReportAPI/LearningHub.Nhs.ReportApi.Services.Interface/LearningHub.Nhs.ReportApi.Services.Interface.csproj +++ b/ReportAPI/LearningHub.Nhs.ReportApi.Services.Interface/LearningHub.Nhs.ReportApi.Services.Interface.csproj @@ -16,7 +16,7 @@ - + diff --git a/ReportAPI/LearningHub.Nhs.ReportApi.Services.UnitTests/LearningHub.Nhs.ReportApi.Services.UnitTests.csproj b/ReportAPI/LearningHub.Nhs.ReportApi.Services.UnitTests/LearningHub.Nhs.ReportApi.Services.UnitTests.csproj index 11a6e79c..fe4ae620 100644 --- a/ReportAPI/LearningHub.Nhs.ReportApi.Services.UnitTests/LearningHub.Nhs.ReportApi.Services.UnitTests.csproj +++ b/ReportAPI/LearningHub.Nhs.ReportApi.Services.UnitTests/LearningHub.Nhs.ReportApi.Services.UnitTests.csproj @@ -18,7 +18,7 @@ - + diff --git a/ReportAPI/LearningHub.Nhs.ReportApi.Services/LearningHub.Nhs.ReportApi.Services.csproj b/ReportAPI/LearningHub.Nhs.ReportApi.Services/LearningHub.Nhs.ReportApi.Services.csproj index 9f581a38..5e395b6e 100644 --- a/ReportAPI/LearningHub.Nhs.ReportApi.Services/LearningHub.Nhs.ReportApi.Services.csproj +++ b/ReportAPI/LearningHub.Nhs.ReportApi.Services/LearningHub.Nhs.ReportApi.Services.csproj @@ -19,7 +19,7 @@ - + diff --git a/ReportAPI/LearningHub.Nhs.ReportApi.Shared/LearningHub.Nhs.ReportApi.Shared.csproj b/ReportAPI/LearningHub.Nhs.ReportApi.Shared/LearningHub.Nhs.ReportApi.Shared.csproj index aa187c6b..db1c765e 100644 --- a/ReportAPI/LearningHub.Nhs.ReportApi.Shared/LearningHub.Nhs.ReportApi.Shared.csproj +++ b/ReportAPI/LearningHub.Nhs.ReportApi.Shared/LearningHub.Nhs.ReportApi.Shared.csproj @@ -17,7 +17,7 @@ - + diff --git a/ReportAPI/LearningHub.Nhs.ReportApi/LearningHub.Nhs.ReportApi.csproj b/ReportAPI/LearningHub.Nhs.ReportApi/LearningHub.Nhs.ReportApi.csproj index ca457a05..57c88df5 100644 --- a/ReportAPI/LearningHub.Nhs.ReportApi/LearningHub.Nhs.ReportApi.csproj +++ b/ReportAPI/LearningHub.Nhs.ReportApi/LearningHub.Nhs.ReportApi.csproj @@ -20,7 +20,7 @@ - + diff --git a/WebAPI/LearningHub.Nhs.API/LearningHub.Nhs.Api.csproj b/WebAPI/LearningHub.Nhs.API/LearningHub.Nhs.Api.csproj index 4f56a92f..9b9094d6 100644 --- a/WebAPI/LearningHub.Nhs.API/LearningHub.Nhs.Api.csproj +++ b/WebAPI/LearningHub.Nhs.API/LearningHub.Nhs.Api.csproj @@ -29,7 +29,7 @@ - + diff --git a/WebAPI/LearningHub.Nhs.Api.Shared/LearningHub.Nhs.Api.Shared.csproj b/WebAPI/LearningHub.Nhs.Api.Shared/LearningHub.Nhs.Api.Shared.csproj index 632c0095..77bf1b44 100644 --- a/WebAPI/LearningHub.Nhs.Api.Shared/LearningHub.Nhs.Api.Shared.csproj +++ b/WebAPI/LearningHub.Nhs.Api.Shared/LearningHub.Nhs.Api.Shared.csproj @@ -9,7 +9,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/WebAPI/LearningHub.Nhs.Api.UnitTests/LearningHub.Nhs.Api.UnitTests.csproj b/WebAPI/LearningHub.Nhs.Api.UnitTests/LearningHub.Nhs.Api.UnitTests.csproj index face608c..86e0c6b2 100644 --- a/WebAPI/LearningHub.Nhs.Api.UnitTests/LearningHub.Nhs.Api.UnitTests.csproj +++ b/WebAPI/LearningHub.Nhs.Api.UnitTests/LearningHub.Nhs.Api.UnitTests.csproj @@ -11,7 +11,7 @@ - + diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Activity/GetUserInProgressLearningActivities.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Activity/GetUserInProgressLearningActivities.sql index 6a188702..70f6a238 100644 --- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Activity/GetUserInProgressLearningActivities.sql +++ b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Activity/GetUserInProgressLearningActivities.sql @@ -41,7 +41,7 @@ BEGIN arv.PassMark AS PassMark, asra.score AS AssesmentScore, mar.SecondsPlayed AS SecondsPlayed, - mar.PercentComplete AS PercentComplete, + ISNULL( CAST(mar.PercentComplete AS INT) ,0) AS PercentComplete, sa.CmiCoreLesson_status AS CmiCoreLessonstatus, sa.CmiCoreScoreMax AS CmiCoreScoreMax, sa.CmiCoreSession_time AS CmiCoreSessiontime, @@ -77,9 +77,11 @@ SELECT Top 8 ActivityId, ActivityStatus, ActivityDate, ActivityDurationSeconds, - ScorePercentage + ScorePercentage, + 0 AS ResourceDurationMilliseconds, + PercentComplete AS CompletionPercentage FROM CTERecentActivities -WHERE rn = 1 AND ActivityStatus IN (2,4,7) -order by ActivityDate desc; +WHERE rn = 1 AND ActivityStatus IN (2,4,7) + order by ActivityDate desc; END \ No newline at end of file diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Activity/GetUserRecentLearningActivities.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Activity/GetUserRecentLearningActivities.sql index 0f9c6d69..6d49a10c 100644 --- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Activity/GetUserRecentLearningActivities.sql +++ b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Activity/GetUserRecentLearningActivities.sql @@ -5,6 +5,7 @@ -- -- Modification History -- 02-Sep-2025 SA Incorrect Syntax +-- 23-09-2025 SA Added new columns for displaying video/Audio Progress ------------------------------------------------------------------------------- CREATE PROCEDURE [activity].[GetUserRecentLearningActivities] ( @userId INT, @@ -43,7 +44,7 @@ BEGIN arv.PassMark AS PassMark, asra.score AS AssesmentScore, mar.SecondsPlayed AS SecondsPlayed, - mar.PercentComplete AS PercentComplete, + ISNULL( CAST(mar.PercentComplete AS INT) ,0) AS PercentComplete, sa.CmiCoreLesson_status AS CmiCoreLessonstatus, sa.CmiCoreScoreMax AS CmiCoreScoreMax, sa.CmiCoreSession_time AS CmiCoreSessiontime, @@ -60,7 +61,7 @@ BEGIN LEFT JOIN [activity].[ScormActivity] sa ON sa.ResourceActivityId = ra.Id WHERE ra.LaunchResourceActivityId IS NULL AND ra.userid = @userId AND ra.deleted = 0 - AND r.ResourceTypeId IN(2,6,7,10,11) AND ra.ActivityStart >= DATEADD(MONTH, -6, SYSDATETIMEOFFSET()) + AND r.ResourceTypeId IN(2,6,7,10,11) AND ra.ActivityStart >= DATEADD(MONTH, -6, SYSDATETIMEOFFSET()) ) SELECT ActivityId, LaunchResourceActivityId, @@ -79,16 +80,18 @@ SELECT ActivityId, ActivityStatus, ActivityDate, ActivityDurationSeconds, - ScorePercentage + ScorePercentage, + 0 AS ResourceDurationMilliseconds, + PercentComplete AS CompletionPercentage FROM CTERecentActivities -WHERE rn = 1 -AND ( +WHERE rn = 1 + AND ( @activityStatuses IS NULL OR ActivityStatus IN ( SELECT TRY_CAST(value AS INT) FROM STRING_SPLIT(@activityStatuses, ',') WHERE TRY_CAST(value AS INT) IS NOT NULL) - ) + ) order by ActivityDate desc; END \ No newline at end of file diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Activity/GetUsersLearningHistory.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Activity/GetUsersLearningHistory.sql index afb02c4b..47fedc43 100644 --- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Activity/GetUsersLearningHistory.sql +++ b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Activity/GetUsersLearningHistory.sql @@ -4,6 +4,7 @@ -- Purpose Get Users learning history -- -- Modification History +-- 23-09-2025 SA Added new columns for displaying video/Audio Progress ------------------------------------------------------------------------------- CREATE PROCEDURE [activity].[GetUsersLearningHistory] ( @userId INT, @@ -33,8 +34,14 @@ BEGIN rvp.ProviderId AS ProviderId, ISNULL(ara.ActivityStatusId, ra.ActivityStatusId) AS ActivityStatus, ra.ActivityStart AS ActivityDate, - ISNULL(ara.DurationSeconds, 0) AS ActivityDurationSeconds, - ara.Score AS ScorePercentage + ISNULL(ara.DurationSeconds, 0) ActivityDurationSeconds, + ara.Score AS ScorePercentage, + CASE + WHEN ResourceTypeId = 2 THEN ISNULL(audiorv.DurationInMilliseconds, 0) + WHEN ResourceTypeId = 7 THEN ISNULL(videorv.DurationInMilliseconds, 0) + ELSE 0 + END AS ResourceDurationMilliseconds, + ISNULL( CAST(mar.PercentComplete AS INT) ,0) AS CompletionPercentage FROM activity.ResourceActivity ra LEFT JOIN activity.ResourceActivity ara ON ara.LaunchResourceActivityId = ra.Id @@ -42,6 +49,8 @@ BEGIN INNER JOIN [resources].[ResourceVersion] rv ON rv.Id = ra.ResourceVersionId AND rv.deleted =0 LEFT JOIN [resources].[ResourceVersionProvider] rvp on rv.Id = rvp.ResourceVersionId LEFT JOIN [resources].[AssessmentResourceVersion] arv ON arv.ResourceVersionId = ra.ResourceVersionId + LEFT JOIN [resources].[AudioResourceVersion] audiorv ON audiorv.ResourceVersionId = ra.ResourceVersionId + LEFT JOIN [resources].[VideoResourceVersion] videorv ON videorv.ResourceVersionId = ra.ResourceVersionId LEFT JOIN [activity].[AssessmentResourceActivity] asra ON asra.ResourceActivityId = ra.Id LEFT JOIN [activity].[MediaResourceActivity] mar ON mar.ResourceActivityId = ra.Id LEFT JOIN [activity].[ScormActivity] sa ON sa.ResourceActivityId = ra.Id diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Activity/GetUsersLearningHistory_Search.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Activity/GetUsersLearningHistory_Search.sql index dcefb871..d3684741 100644 --- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Activity/GetUsersLearningHistory_Search.sql +++ b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Activity/GetUsersLearningHistory_Search.sql @@ -4,6 +4,7 @@ -- Purpose Get Users learning history Search -- -- Modification History +-- 23-09-2025 SA Added new columns for displaying video/Audio Progress ------------------------------------------------------------------------------- CREATE PROCEDURE [activity].[GetUsersLearningHistory_Search] ( @userId INT, @@ -37,7 +38,13 @@ BEGIN ISNULL(ara.ActivityStatusId, ra.ActivityStatusId) AS ActivityStatus, ra.ActivityStart AS ActivityDate, ISNULL(ara.DurationSeconds, 0) AS ActivityDurationSeconds, - ara.Score AS ScorePercentage + ara.Score AS ScorePercentage, + CASE + WHEN ResourceTypeId = 2 THEN ISNULL(audiorv.DurationInMilliseconds, 0) + WHEN ResourceTypeId = 7 THEN ISNULL(videorv.DurationInMilliseconds, 0) + ELSE 0 + END AS ResourceDurationMilliseconds, + ISNULL( CAST(mar.PercentComplete AS INT) ,0) AS CompletionPercentage FROM activity.ResourceActivity ra LEFT JOIN activity.ResourceActivity ara ON ara.LaunchResourceActivityId = ra.Id @@ -45,6 +52,8 @@ BEGIN INNER JOIN [resources].[ResourceVersion] rv ON rv.Id = ra.ResourceVersionId AND rv.deleted =0 LEFT JOIN [resources].[ResourceVersionProvider] rvp on rv.Id = rvp.ResourceVersionId LEFT JOIN [resources].[AssessmentResourceVersion] arv ON arv.ResourceVersionId = ra.ResourceVersionId + LEFT JOIN [resources].[AudioResourceVersion] audiorv ON audiorv.ResourceVersionId = ra.ResourceVersionId + LEFT JOIN [resources].[VideoResourceVersion] videorv ON videorv.ResourceVersionId = ra.ResourceVersionId LEFT JOIN [activity].[AssessmentResourceActivity] asra ON asra.ResourceActivityId = ra.Id LEFT JOIN [activity].[MediaResourceActivity] mar ON mar.ResourceActivityId = ra.Id LEFT JOIN [activity].[ScormActivity] sa ON sa.ResourceActivityId = ra.Id diff --git a/WebAPI/LearningHub.Nhs.Repository.Interface/LearningHub.Nhs.Repository.Interface.csproj b/WebAPI/LearningHub.Nhs.Repository.Interface/LearningHub.Nhs.Repository.Interface.csproj index 39819f52..0d9fe9a7 100644 --- a/WebAPI/LearningHub.Nhs.Repository.Interface/LearningHub.Nhs.Repository.Interface.csproj +++ b/WebAPI/LearningHub.Nhs.Repository.Interface/LearningHub.Nhs.Repository.Interface.csproj @@ -10,7 +10,7 @@ - + diff --git a/WebAPI/LearningHub.Nhs.Repository/LearningHub.Nhs.Repository.csproj b/WebAPI/LearningHub.Nhs.Repository/LearningHub.Nhs.Repository.csproj index 72207c3c..b84ba0eb 100644 --- a/WebAPI/LearningHub.Nhs.Repository/LearningHub.Nhs.Repository.csproj +++ b/WebAPI/LearningHub.Nhs.Repository/LearningHub.Nhs.Repository.csproj @@ -9,7 +9,7 @@ - + diff --git a/WebAPI/LearningHub.Nhs.Services.Interface/LearningHub.Nhs.Services.Interface.csproj b/WebAPI/LearningHub.Nhs.Services.Interface/LearningHub.Nhs.Services.Interface.csproj index 6303c6b9..9cee8f5f 100644 --- a/WebAPI/LearningHub.Nhs.Services.Interface/LearningHub.Nhs.Services.Interface.csproj +++ b/WebAPI/LearningHub.Nhs.Services.Interface/LearningHub.Nhs.Services.Interface.csproj @@ -16,7 +16,7 @@ - + all diff --git a/WebAPI/LearningHub.Nhs.Services.UnitTests/LearningHub.Nhs.Services.UnitTests.csproj b/WebAPI/LearningHub.Nhs.Services.UnitTests/LearningHub.Nhs.Services.UnitTests.csproj index 2423b000..d95bacd9 100644 --- a/WebAPI/LearningHub.Nhs.Services.UnitTests/LearningHub.Nhs.Services.UnitTests.csproj +++ b/WebAPI/LearningHub.Nhs.Services.UnitTests/LearningHub.Nhs.Services.UnitTests.csproj @@ -13,7 +13,7 @@ - + diff --git a/WebAPI/LearningHub.Nhs.Services/LearningHub.Nhs.Services.csproj b/WebAPI/LearningHub.Nhs.Services/LearningHub.Nhs.Services.csproj index fe334e6e..694f3f7d 100644 --- a/WebAPI/LearningHub.Nhs.Services/LearningHub.Nhs.Services.csproj +++ b/WebAPI/LearningHub.Nhs.Services/LearningHub.Nhs.Services.csproj @@ -13,7 +13,7 @@ - + diff --git a/WebAPI/MigrationTool/LearningHub.Nhs.Migration.ConsoleApp/LearningHub.Nhs.Migration.ConsoleApp.csproj b/WebAPI/MigrationTool/LearningHub.Nhs.Migration.ConsoleApp/LearningHub.Nhs.Migration.ConsoleApp.csproj index 7010544b..3939305a 100644 --- a/WebAPI/MigrationTool/LearningHub.Nhs.Migration.ConsoleApp/LearningHub.Nhs.Migration.ConsoleApp.csproj +++ b/WebAPI/MigrationTool/LearningHub.Nhs.Migration.ConsoleApp/LearningHub.Nhs.Migration.ConsoleApp.csproj @@ -25,7 +25,7 @@ - + all diff --git a/WebAPI/MigrationTool/LearningHub.Nhs.Migration.Interface/LearningHub.Nhs.Migration.Interface.csproj b/WebAPI/MigrationTool/LearningHub.Nhs.Migration.Interface/LearningHub.Nhs.Migration.Interface.csproj index f3fcefa1..0874d695 100644 --- a/WebAPI/MigrationTool/LearningHub.Nhs.Migration.Interface/LearningHub.Nhs.Migration.Interface.csproj +++ b/WebAPI/MigrationTool/LearningHub.Nhs.Migration.Interface/LearningHub.Nhs.Migration.Interface.csproj @@ -9,7 +9,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/WebAPI/MigrationTool/LearningHub.Nhs.Migration.Models/LearningHub.Nhs.Migration.Models.csproj b/WebAPI/MigrationTool/LearningHub.Nhs.Migration.Models/LearningHub.Nhs.Migration.Models.csproj index da6a6ed5..cdb56c81 100644 --- a/WebAPI/MigrationTool/LearningHub.Nhs.Migration.Models/LearningHub.Nhs.Migration.Models.csproj +++ b/WebAPI/MigrationTool/LearningHub.Nhs.Migration.Models/LearningHub.Nhs.Migration.Models.csproj @@ -10,7 +10,7 @@ - + all diff --git a/WebAPI/MigrationTool/LearningHub.Nhs.Migration.Staging.Repository/LearningHub.Nhs.Migration.Staging.Repository.csproj b/WebAPI/MigrationTool/LearningHub.Nhs.Migration.Staging.Repository/LearningHub.Nhs.Migration.Staging.Repository.csproj index e42a1543..8c9e9efc 100644 --- a/WebAPI/MigrationTool/LearningHub.Nhs.Migration.Staging.Repository/LearningHub.Nhs.Migration.Staging.Repository.csproj +++ b/WebAPI/MigrationTool/LearningHub.Nhs.Migration.Staging.Repository/LearningHub.Nhs.Migration.Staging.Repository.csproj @@ -9,7 +9,7 @@ - + diff --git a/WebAPI/MigrationTool/LearningHub.Nhs.Migration.UnitTests/LearningHub.Nhs.Migration.UnitTests.csproj b/WebAPI/MigrationTool/LearningHub.Nhs.Migration.UnitTests/LearningHub.Nhs.Migration.UnitTests.csproj index b7b96b73..59289599 100644 --- a/WebAPI/MigrationTool/LearningHub.Nhs.Migration.UnitTests/LearningHub.Nhs.Migration.UnitTests.csproj +++ b/WebAPI/MigrationTool/LearningHub.Nhs.Migration.UnitTests/LearningHub.Nhs.Migration.UnitTests.csproj @@ -10,7 +10,7 @@ - + diff --git a/WebAPI/MigrationTool/LearningHub.Nhs.Migration/LearningHub.Nhs.Migration.csproj b/WebAPI/MigrationTool/LearningHub.Nhs.Migration/LearningHub.Nhs.Migration.csproj index bea79d97..c39d51d7 100644 --- a/WebAPI/MigrationTool/LearningHub.Nhs.Migration/LearningHub.Nhs.Migration.csproj +++ b/WebAPI/MigrationTool/LearningHub.Nhs.Migration/LearningHub.Nhs.Migration.csproj @@ -12,7 +12,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive