diff --git a/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/SelfAssessmentReports/SelfAssessmentReportsController.cs b/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/SelfAssessmentReports/SelfAssessmentReportsController.cs index 54699c02da..890ee2b4da 100644 --- a/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/SelfAssessmentReports/SelfAssessmentReportsController.cs +++ b/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/SelfAssessmentReports/SelfAssessmentReportsController.cs @@ -1,19 +1,22 @@ 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; + using Microsoft.FeatureManagement.Mvc; + using System; + using System.Threading.Tasks; [FeatureGate(FeatureFlags.RefactoredTrackingSystem)] [Authorize(Policy = CustomPolicies.UserCentreAdmin)] @@ -30,12 +33,14 @@ public class SelfAssessmentReportsController : Controller private readonly string workbookName; private readonly string viewName; private readonly ISelfAssessmentService selfAssessmentService; + private readonly IFeatureManager featureManager; public SelfAssessmentReportsController( ISelfAssessmentReportService selfAssessmentReportService, ITableauConnectionHelperService tableauConnectionHelper, IClockUtility clockUtility, IConfiguration config, - ISelfAssessmentService selfAssessmentService + ISelfAssessmentService selfAssessmentService, + IFeatureManager featureManager ) { this.selfAssessmentReportService = selfAssessmentReportService; @@ -46,13 +51,17 @@ ISelfAssessmentService selfAssessmentService workbookName = config.GetTableauWorkbookName(); viewName = config.GetTableauViewName(); this.selfAssessmentService = selfAssessmentService; + this.featureManager = featureManager; } - public IActionResult Index() + public async Task IndexAsync() { 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); + 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); 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 6947aad14b..a1b67e6bf0 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 showTableauLink ) { SelfAssessmentSelects = selfAssessmentSelects; AdminCategoryId = adminCategoryId; CategoryId = categoryId; + ShowTableauLink = showTableauLink; } public IEnumerable SelfAssessmentSelects { get; set; } public int? AdminCategoryId { get; set; } public int CategoryId { get; set; } + public bool ShowTableauLink { get; set; } = false; } } diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/SelfAssessmentReports/Index.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/SelfAssessmentReports/Index.cshtml index d68daf4064..856e707135 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/SelfAssessmentReports/Index.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/SelfAssessmentReports/Index.cshtml @@ -19,22 +19,20 @@ - @ViewData["Title"] - - @if (Model.SelfAssessmentSelects.Any()) - { - - } - + @if (Model.ShowTableauLink && Model.SelfAssessmentSelects.Any()) + { + + }

Excel learner activity reports

Download Excel competency self assessments activity reports for your centre.

    - @if((Model.AdminCategoryId == null) || (Model.AdminCategoryId == Model.CategoryId)) - { -
  • - Digital Skills Assessment Tool - Download report + @if ((Model.AdminCategoryId == null) || (Model.AdminCategoryId == Model.CategoryId)) + { +
  • + Digital Skills Assessment Tool - Download report -
  • - } + + } @if (Model.SelfAssessmentSelects.Any()) { @foreach (var report in Model.SelfAssessmentSelects) diff --git a/DigitalLearningSolutions.Web/appSettings.UAT.json b/DigitalLearningSolutions.Web/appSettings.UAT.json index 3c6921bb01..1b8fb121a0 100644 --- a/DigitalLearningSolutions.Web/appSettings.UAT.json +++ b/DigitalLearningSolutions.Web/appSettings.UAT.json @@ -22,7 +22,8 @@ "UserFeedbackBar": true, "ExportQueryRowLimit": 250, "MaxBulkUploadRows": 200, - "LoginWithLearningHub": true + "LoginWithLearningHub": true, + "TableauSelfAssessmentDashboards": false }, "LearningHubOpenAPIBaseUrl": "https://uks-learninghubnhsuk-openapi-test.azurewebsites.net", "FreshdeskAPIConfig": { diff --git a/DigitalLearningSolutions.Web/appsettings.Development.json b/DigitalLearningSolutions.Web/appsettings.Development.json index d264292ccf..357b01017c 100644 --- a/DigitalLearningSolutions.Web/appsettings.Development.json +++ b/DigitalLearningSolutions.Web/appsettings.Development.json @@ -22,7 +22,8 @@ "UserFeedbackBar": true, "ExportQueryRowLimit": 250, "MaxBulkUploadRows": 200, - "LoginWithLearningHub": true + "LoginWithLearningHub": true, + "TableauSelfAssessmentDashboards": false }, "LearningHubOpenAPIBaseUrl": "https://uks-learninghubnhsuk-openapi-test.azurewebsites.net", "LearningHubReportAPIConfig": {