From 5beabf1f4c65e0acf6bf324a0b828602e7a70324 Mon Sep 17 00:00:00 2001 From: sherif-olaboye <123654949+sherif-olaboye@users.noreply.github.com> Date: Wed, 18 Jun 2025 12:07:09 +0100 Subject: [PATCH 1/3] TD-5683 Issue showing self assessment reports on Tracking system which are not published at the centre --- .../SelfAssessmentReportsController.cs | 30 +++++++++++-------- .../Reports/SelfAssessmentReportsViewModel.cs | 4 ++- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/SelfAssessmentReports/SelfAssessmentReportsController.cs b/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/SelfAssessmentReports/SelfAssessmentReportsController.cs index 54699c02da..a1b3d72bab 100644 --- a/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/SelfAssessmentReports/SelfAssessmentReportsController.cs +++ b/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/SelfAssessmentReports/SelfAssessmentReportsController.cs @@ -1,20 +1,20 @@ namespace DigitalLearningSolutions.Web.Controllers.TrackingSystem.Centre.SelfAssessmentReports { + using DigitalLearningSolutions.Data.Enums; + using DigitalLearningSolutions.Data.Extensions; using DigitalLearningSolutions.Data.Services; - using DigitalLearningSolutions.Web.Helpers; - using Microsoft.AspNetCore.Authorization; - using Microsoft.AspNetCore.Mvc; - using Microsoft.FeatureManagement.Mvc; + using DigitalLearningSolutions.Data.Utilities; using DigitalLearningSolutions.Web.Attributes; + using DigitalLearningSolutions.Web.Helpers; + using DigitalLearningSolutions.Web.Helpers.ExternalApis; using DigitalLearningSolutions.Web.Models.Enums; - using DigitalLearningSolutions.Data.Enums; - using DigitalLearningSolutions.Data.Utilities; + using DigitalLearningSolutions.Web.Services; using DigitalLearningSolutions.Web.ViewModels.TrackingSystem.Centre.Reports; - using DigitalLearningSolutions.Web.Helpers.ExternalApis; + using Microsoft.AspNetCore.Authorization; + using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; - using DigitalLearningSolutions.Data.Extensions; - using DigitalLearningSolutions.Web.Services; - + using Microsoft.FeatureManagement.Mvc; + using System.Linq; [FeatureGate(FeatureFlags.RefactoredTrackingSystem)] [Authorize(Policy = CustomPolicies.UserCentreAdmin)] [SetDlsSubApplication(nameof(DlsSubApplication.TrackingSystem))] @@ -30,12 +30,14 @@ public class SelfAssessmentReportsController : Controller private readonly string workbookName; private readonly string viewName; private readonly ISelfAssessmentService selfAssessmentService; + private readonly ICentreSelfAssessmentsService centreSelfAssessmentsService; public SelfAssessmentReportsController( ISelfAssessmentReportService selfAssessmentReportService, ITableauConnectionHelperService tableauConnectionHelper, IClockUtility clockUtility, IConfiguration config, - ISelfAssessmentService selfAssessmentService + ISelfAssessmentService selfAssessmentService, + ICentreSelfAssessmentsService centreSelfAssessmentsService ) { this.selfAssessmentReportService = selfAssessmentReportService; @@ -46,14 +48,16 @@ ISelfAssessmentService selfAssessmentService workbookName = config.GetTableauWorkbookName(); viewName = config.GetTableauViewName(); this.selfAssessmentService = selfAssessmentService; + this.centreSelfAssessmentsService = centreSelfAssessmentsService; } public IActionResult Index() { var centreId = User.GetCentreId(); var adminCategoryId = User.GetAdminCategoryId(); var categoryId = this.selfAssessmentService.GetSelfAssessmentCategoryId(1); - var model = new SelfAssessmentReportsViewModel(selfAssessmentReportService.GetSelfAssessmentsForReportList((int)centreId, adminCategoryId), adminCategoryId, categoryId); - return View(model); + var selfAssessments = centreSelfAssessmentsService.GetCentreSelfAssessments(centreId.Value); + var dSATreportIsPublish = selfAssessments.Any(x => x.SelfAssessmentId == 1); + var model = new SelfAssessmentReportsViewModel(selfAssessmentReportService.GetSelfAssessmentsForReportList((int)centreId, adminCategoryId), adminCategoryId, categoryId, dSATreportIsPublish); return View(model); } [HttpGet] [Route("DownloadDcsa")] diff --git a/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Centre/Reports/SelfAssessmentReportsViewModel.cs b/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Centre/Reports/SelfAssessmentReportsViewModel.cs index 6947aad14b..79e152b071 100644 --- a/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Centre/Reports/SelfAssessmentReportsViewModel.cs +++ b/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Centre/Reports/SelfAssessmentReportsViewModel.cs @@ -6,15 +6,17 @@ public class SelfAssessmentReportsViewModel { public SelfAssessmentReportsViewModel( - IEnumerable selfAssessmentSelects, int? adminCategoryId, int categoryId + IEnumerable selfAssessmentSelects, int? adminCategoryId, int categoryId, bool dSATreportIsPublish ) { SelfAssessmentSelects = selfAssessmentSelects; AdminCategoryId = adminCategoryId; CategoryId = categoryId; + DSATreportIsPublish = dSATreportIsPublish; } public IEnumerable SelfAssessmentSelects { get; set; } public int? AdminCategoryId { get; set; } public int CategoryId { get; set; } + public bool DSATreportIsPublish { get; set; } } } From 34c67caaf555a118d3a273cdab9732044180ef51 Mon Sep 17 00:00:00 2001 From: sherif-olaboye <123654949+sherif-olaboye@users.noreply.github.com> Date: Wed, 18 Jun 2025 12:10:34 +0100 Subject: [PATCH 2/3] TD-5683 Issue showing self assessment reports on Tracking system which are not published at the centre --- .../TrackingSystem/Centre/SelfAssessmentReports/Index.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/SelfAssessmentReports/Index.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/SelfAssessmentReports/Index.cshtml index d68daf4064..4ac21fbff0 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/SelfAssessmentReports/Index.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/SelfAssessmentReports/Index.cshtml @@ -28,7 +28,7 @@

Excel learner activity reports

Download Excel competency self assessments activity reports for your centre.

    - @if((Model.AdminCategoryId == null) || (Model.AdminCategoryId == Model.CategoryId)) + @if((Model.DSATreportIsPublish) && ((Model.AdminCategoryId == null) || (Model.AdminCategoryId == Model.CategoryId))) {
  • Digital Skills Assessment Tool - Download report From 7221ade2fad417877d47fdb782ad6d154b205670 Mon Sep 17 00:00:00 2001 From: sherif-olaboye <123654949+sherif-olaboye@users.noreply.github.com> Date: Mon, 15 Sep 2025 10:24:56 +0100 Subject: [PATCH 3/3] TD-5683 Resolving PR conflicts --- .../SelfAssessmentReportsController.cs | 6 +++--- .../Centre/Reports/SelfAssessmentReportsViewModel.cs | 3 +-- .../Centre/SelfAssessmentReports/Index.cshtml | 8 ++++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/SelfAssessmentReports/SelfAssessmentReportsController.cs b/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/SelfAssessmentReports/SelfAssessmentReportsController.cs index 6bdd6dd327..483c75ef3a 100644 --- a/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/SelfAssessmentReports/SelfAssessmentReportsController.cs +++ b/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/SelfAssessmentReports/SelfAssessmentReportsController.cs @@ -16,6 +16,7 @@ using Microsoft.FeatureManagement; using Microsoft.FeatureManagement.Mvc; using System; + using System.Linq; using System.Threading.Tasks; [FeatureGate(FeatureFlags.RefactoredTrackingSystem)] [Authorize(Policy = CustomPolicies.UserCentreAdmin)] @@ -40,7 +41,7 @@ public SelfAssessmentReportsController( IClockUtility clockUtility, IConfiguration config, ISelfAssessmentService selfAssessmentService, - ICentreSelfAssessmentsService centreSelfAssessmentsService + ICentreSelfAssessmentsService centreSelfAssessmentsService, IFeatureManager featureManager ) { @@ -63,11 +64,10 @@ public async Task IndexAsync() var categoryId = this.selfAssessmentService.GetSelfAssessmentCategoryId(1); var selfAssessments = centreSelfAssessmentsService.GetCentreSelfAssessments(centreId.Value); var dSATreportIsPublish = selfAssessments.Any(x => x.SelfAssessmentId == 1); - var model = new SelfAssessmentReportsViewModel(selfAssessmentReportService.GetSelfAssessmentsForReportList((int)centreId, adminCategoryId), adminCategoryId, categoryId, dSATreportIsPublish); return View(model); var tableauFlag = await featureManager.IsEnabledAsync(FeatureFlags.TableauSelfAssessmentDashboards); var tableauQueryOverride = string.Equals(Request.Query["tableaulink"], "true", StringComparison.OrdinalIgnoreCase); var showTableauLink = tableauFlag || tableauQueryOverride; - var model = new SelfAssessmentReportsViewModel(selfAssessmentReportService.GetSelfAssessmentsForReportList((int)centreId, adminCategoryId), adminCategoryId, categoryId, showTableauLink); + var model = new SelfAssessmentReportsViewModel(selfAssessmentReportService.GetSelfAssessmentsForReportList((int)centreId, adminCategoryId), adminCategoryId, categoryId, dSATreportIsPublish, showTableauLink); return View(model); } [HttpGet] diff --git a/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Centre/Reports/SelfAssessmentReportsViewModel.cs b/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Centre/Reports/SelfAssessmentReportsViewModel.cs index 39498ab9f1..dc4da36717 100644 --- a/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Centre/Reports/SelfAssessmentReportsViewModel.cs +++ b/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Centre/Reports/SelfAssessmentReportsViewModel.cs @@ -6,8 +6,7 @@ public class SelfAssessmentReportsViewModel { public SelfAssessmentReportsViewModel( - IEnumerable selfAssessmentSelects, int? adminCategoryId, int categoryId, bool dSATreportIsPublish - IEnumerable selfAssessmentSelects, int? adminCategoryId, int categoryId, bool showTableauLink + IEnumerable selfAssessmentSelects, int? adminCategoryId, int categoryId, bool dSATreportIsPublish, bool showTableauLink ) { SelfAssessmentSelects = selfAssessmentSelects; diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/SelfAssessmentReports/Index.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/SelfAssessmentReports/Index.cshtml index 1656dc1dcf..a7c12bea6e 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/SelfAssessmentReports/Index.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/SelfAssessmentReports/Index.cshtml @@ -33,10 +33,10 @@

    Excel learner activity reports

    Download Excel competency self assessments activity reports for your centre.