Skip to content
Merged
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
@@ -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)]
Expand All @@ -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;
Expand All @@ -46,13 +51,17 @@ ISelfAssessmentService selfAssessmentService
workbookName = config.GetTableauWorkbookName();
viewName = config.GetTableauViewName();
this.selfAssessmentService = selfAssessmentService;
this.featureManager = featureManager;
}
public IActionResult Index()
public async Task<IActionResult> 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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@
public class SelfAssessmentReportsViewModel
{
public SelfAssessmentReportsViewModel(
IEnumerable<SelfAssessmentSelect> selfAssessmentSelects, int? adminCategoryId, int categoryId
IEnumerable<SelfAssessmentSelect> selfAssessmentSelects, int? adminCategoryId, int categoryId, bool showTableauLink
)
{
SelfAssessmentSelects = selfAssessmentSelects;
AdminCategoryId = adminCategoryId;
CategoryId = categoryId;
ShowTableauLink = showTableauLink;
}
public IEnumerable<SelfAssessmentSelect> SelfAssessmentSelects { get; set; }
public int? AdminCategoryId { get; set; }
public int CategoryId { get; set; }
public bool ShowTableauLink { get; set; } = false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,20 @@
<span class="nhsuk-u-visually-hidden"> - </span>
</span>@ViewData["Title"]
</h1>
<feature name="@(FeatureFlags.TableauSelfAssessmentDashboards)">
@if (Model.SelfAssessmentSelects.Any())
{
<vc:action-link asp-controller="SelfAssessmentReports" asp-action="TableauCompetencyDashboard" asp-all-route-data="@new Dictionary<string, string>();" link-text="View Tableau supervised self assessments dashboard" />
}
</feature>
@if (Model.ShowTableauLink && Model.SelfAssessmentSelects.Any())
{
<vc:action-link asp-controller="SelfAssessmentReports" asp-action="TableauCompetencyDashboard" asp-all-route-data="@new Dictionary<string, string>();" link-text="View Tableau supervised self assessments dashboard" />
}
<h2>Excel learner activity reports</h2>
<p class="nhsuk-lede-text">Download Excel competency self assessments activity reports for your centre.</p>
<ul>
@if((Model.AdminCategoryId == null) || (Model.AdminCategoryId == Model.CategoryId))
{
<li>
<a asp-controller="SelfAssessmentReports" asp-action="DownloadDigitalCapabilityToExcel">Digital Skills Assessment Tool - Download report</a>
@if ((Model.AdminCategoryId == null) || (Model.AdminCategoryId == Model.CategoryId))
{
<li>
<a asp-controller="SelfAssessmentReports" asp-action="DownloadDigitalCapabilityToExcel">Digital Skills Assessment Tool - Download report</a>

</li>
}
</li>
}
@if (Model.SelfAssessmentSelects.Any())
{
@foreach (var report in Model.SelfAssessmentSelects)
Expand Down
3 changes: 2 additions & 1 deletion DigitalLearningSolutions.Web/appSettings.UAT.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion DigitalLearningSolutions.Web/appsettings.Development.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Loading