Skip to content

Commit 23f7100

Browse files
Merge branch 'DLS-Release-v1.2.3' into Develop/Features/TD-5669-Learnersenrollingontoaretiringselfassessment
2 parents e63a596 + b2322ba commit 23f7100

File tree

13 files changed

+179
-83
lines changed

13 files changed

+179
-83
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using FluentMigrator;
2+
3+
namespace DigitalLearningSolutions.Data.Migrations
4+
{
5+
[Migration(202507240953)]
6+
public class Alter_GetActivitiesForDelegateEnrolment_Retired_SA : Migration
7+
{
8+
public override void Up()
9+
{
10+
Execute.Sql(Properties.Resources.TD_5535_Alter_GetActivitiesForDelegateEnrolment_Up);
11+
}
12+
public override void Down()
13+
{
14+
Execute.Sql(Properties.Resources.TD_5535_Alter_GetActivitiesForDelegateEnrolment_Down);
15+
}
16+
}
17+
}
18+

DigitalLearningSolutions.Data.Migrations/Properties/Resources.Designer.cs

Lines changed: 64 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

DigitalLearningSolutions.Data.Migrations/Properties/Resources.resx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,4 +499,10 @@
499499
<data name="TD-5759_CreateOrAlterSelfAssessmentReportSPandTVF-Fix_UP" type="System.Resources.ResXFileRef, System.Windows.Forms">
500500
<value>..\Scripts\TD-5759_CreateOrAlterSelfAssessmentReportSPandTVF-Fix_UP.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
501501
</data>
502+
<data name="TD_5535_Alter_GetActivitiesForDelegateEnrolment_Down" type="System.Resources.ResXFileRef, System.Windows.Forms">
503+
<value>..\Scripts\TD-5535-Alter_GetActivitiesForDelegateEnrolment_Down.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
504+
</data>
505+
<data name="TD_5535_Alter_GetActivitiesForDelegateEnrolment_Up" type="System.Resources.ResXFileRef, System.Windows.Forms">
506+
<value>..\Scripts\TD-5535-Alter_GetActivitiesForDelegateEnrolment_Up.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
507+
</data>
502508
</root>

DigitalLearningSolutions.Data/DataServices/SelfAssessmentDataService/CandidateAssessmentsDataService.cs

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,31 @@ public IEnumerable<CurrentSelfAssessment> GetSelfAssessmentsForCandidate(int del
1212
{
1313
return connection.Query<CurrentSelfAssessment>(
1414
@"SELECT SelfAssessment.Id,
15-
SelfAssessment.Name,
16-
SelfAssessment.Description,
17-
SelfAssessment.IncludesSignposting,
18-
SelfAssessment.IncludeRequirementsFilters,
19-
SelfAssessment. IsSupervisorResultsReviewed,
20-
SelfAssessment.ReviewerCommentsLabel,
21-
SelfAssessment. Vocabulary,
22-
SelfAssessment. NumberOfCompetencies,
23-
SelfAssessment.StartedDate,
24-
SelfAssessment.LastAccessed,
25-
SelfAssessment.CompleteByDate,
26-
SelfAssessment.CandidateAssessmentId,
27-
SelfAssessment.UserBookmark,
28-
SelfAssessment.UnprocessedUpdates,
29-
SelfAssessment.LaunchCount,
30-
SelfAssessment. IsSelfAssessment,
31-
SelfAssessment.SubmittedDate,
32-
SelfAssessment. CentreName,
33-
SelfAssessment.EnrolmentMethodId,
34-
Signoff.SignedOff,
35-
Signoff.Verified,
36-
EnrolledByForename +' '+EnrolledBySurname AS EnrolledByFullName
15+
SelfAssessment.Name,
16+
SelfAssessment.Description,
17+
SelfAssessment.IncludesSignposting,
18+
SelfAssessment.IncludeRequirementsFilters,
19+
SelfAssessment. IsSupervisorResultsReviewed,
20+
SelfAssessment.ReviewerCommentsLabel,
21+
SelfAssessment. Vocabulary,
22+
SelfAssessment. NumberOfCompetencies,
23+
SelfAssessment.StartedDate,
24+
SelfAssessment.LastAccessed,
25+
SelfAssessment.CompleteByDate,
26+
SelfAssessment.CandidateAssessmentId,
27+
SelfAssessment.UserBookmark,
28+
SelfAssessment.UnprocessedUpdates,
29+
SelfAssessment.LaunchCount,
30+
SelfAssessment. IsSelfAssessment,
31+
SelfAssessment.SubmittedDate,
32+
SelfAssessment. CentreName,
33+
SelfAssessment.EnrolmentMethodId,
34+
SelfAssessment.RetirementDate,
35+
SelfAssessment.EnrolmentCutoffDate,
36+
SelfAssessment.RetirementReason,
37+
Signoff.SignedOff,
38+
Signoff.Verified,
39+
EnrolledByForename +' '+EnrolledBySurname AS EnrolledByFullName
3740
FROM (SELECT
3841
CA.SelfAssessmentID AS Id,
3942
SA.Name,
@@ -56,7 +59,10 @@ public IEnumerable<CurrentSelfAssessment> GetSelfAssessmentsForCandidate(int del
5659
CR.CentreName AS CentreName,
5760
CA.EnrolmentMethodId,
5861
uEnrolledBy.FirstName AS EnrolledByForename,
59-
uEnrolledBy.LastName AS EnrolledBySurname
62+
uEnrolledBy.LastName AS EnrolledBySurname,
63+
SA.RetirementDate,
64+
SA.EnrolmentCutoffDate,
65+
SA.RetirementReason
6066
FROM Centres AS CR INNER JOIN
6167
CandidateAssessments AS CA INNER JOIN
6268
SelfAssessments AS SA ON CA.SelfAssessmentID = SA.ID ON CR.CentreID = CA.CentreID INNER JOIN
@@ -71,7 +77,7 @@ Competencies AS C RIGHT OUTER JOIN
7177
AND (ISNULL(@adminIdCategoryID, 0) = 0 OR sa.CategoryID = @adminIdCategoryId)
7278
GROUP BY
7379
CA.SelfAssessmentID, SA.Name, SA.Description, SA.IncludesSignposting, SA.SupervisorResultsReview,
74-
SA.ReviewerCommentsLabel, SA.IncludeRequirementsFilters,
80+
SA.ReviewerCommentsLabel, SA.IncludeRequirementsFilters, SA.RetirementDate,SA.EnrolmentCutoffDate,SA.RetirementReason,
7581
COALESCE(SA.Vocabulary, 'Capability'), CA.StartedDate, CA.LastAccessed, CA.CompleteByDate,
7682
CA.ID,
7783
CA.UserBookmark, CA.UnprocessedUpdates, CA.LaunchCount, CA.SubmittedDate, CR.CentreName,CA.EnrolmentMethodId,

DigitalLearningSolutions.Data/Models/SelfAssessments/SelfAssessment.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
23
namespace DigitalLearningSolutions.Data.Models.SelfAssessments
34
{
45
public class SelfAssessment : CurrentLearningItem
@@ -14,5 +15,8 @@ public class SelfAssessment : CurrentLearningItem
1415
public string? DescriptionLabel { get; set; }
1516
public DateTime? RetirementDate { get; set; }
1617

18+
public DateTime? EnrolmentCutoffDate { get; set; }
19+
public string? RetirementReason { get; set; }
20+
1721
}
1822
}

DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/SelfAssessmentReports/SelfAssessmentReportsController.cs

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
namespace DigitalLearningSolutions.Web.Controllers.TrackingSystem.Centre.SelfAssessmentReports
22
{
3+
using DigitalLearningSolutions.Data.Enums;
4+
using DigitalLearningSolutions.Data.Extensions;
35
using DigitalLearningSolutions.Data.Services;
4-
using DigitalLearningSolutions.Web.Helpers;
5-
using Microsoft.AspNetCore.Authorization;
6-
using Microsoft.AspNetCore.Mvc;
7-
using Microsoft.FeatureManagement.Mvc;
6+
using DigitalLearningSolutions.Data.Utilities;
87
using DigitalLearningSolutions.Web.Attributes;
8+
using DigitalLearningSolutions.Web.Helpers;
9+
using DigitalLearningSolutions.Web.Helpers.ExternalApis;
910
using DigitalLearningSolutions.Web.Models.Enums;
10-
using DigitalLearningSolutions.Data.Enums;
11-
using DigitalLearningSolutions.Data.Utilities;
11+
using DigitalLearningSolutions.Web.Services;
1212
using DigitalLearningSolutions.Web.ViewModels.TrackingSystem.Centre.Reports;
13-
using DigitalLearningSolutions.Web.Helpers.ExternalApis;
13+
using Microsoft.AspNetCore.Authorization;
14+
using Microsoft.AspNetCore.Mvc;
1415
using Microsoft.Extensions.Configuration;
15-
using DigitalLearningSolutions.Data.Extensions;
16-
using DigitalLearningSolutions.Web.Services;
16+
using Microsoft.FeatureManagement;
17+
using Microsoft.FeatureManagement.Mvc;
18+
using System;
19+
using System.Threading.Tasks;
1720

1821
[FeatureGate(FeatureFlags.RefactoredTrackingSystem)]
1922
[Authorize(Policy = CustomPolicies.UserCentreAdmin)]
@@ -30,12 +33,14 @@ public class SelfAssessmentReportsController : Controller
3033
private readonly string workbookName;
3134
private readonly string viewName;
3235
private readonly ISelfAssessmentService selfAssessmentService;
36+
private readonly IFeatureManager featureManager;
3337
public SelfAssessmentReportsController(
3438
ISelfAssessmentReportService selfAssessmentReportService,
3539
ITableauConnectionHelperService tableauConnectionHelper,
3640
IClockUtility clockUtility,
3741
IConfiguration config,
38-
ISelfAssessmentService selfAssessmentService
42+
ISelfAssessmentService selfAssessmentService,
43+
IFeatureManager featureManager
3944
)
4045
{
4146
this.selfAssessmentReportService = selfAssessmentReportService;
@@ -46,13 +51,17 @@ ISelfAssessmentService selfAssessmentService
4651
workbookName = config.GetTableauWorkbookName();
4752
viewName = config.GetTableauViewName();
4853
this.selfAssessmentService = selfAssessmentService;
54+
this.featureManager = featureManager;
4955
}
50-
public IActionResult Index()
56+
public async Task<IActionResult> IndexAsync()
5157
{
5258
var centreId = User.GetCentreId();
5359
var adminCategoryId = User.GetAdminCategoryId();
5460
var categoryId = this.selfAssessmentService.GetSelfAssessmentCategoryId(1);
55-
var model = new SelfAssessmentReportsViewModel(selfAssessmentReportService.GetSelfAssessmentsForReportList((int)centreId, adminCategoryId), adminCategoryId, categoryId);
61+
var tableauFlag = await featureManager.IsEnabledAsync(FeatureFlags.TableauSelfAssessmentDashboards);
62+
var tableauQueryOverride = string.Equals(Request.Query["tableaulink"], "true", StringComparison.OrdinalIgnoreCase);
63+
var showTableauLink = tableauFlag || tableauQueryOverride;
64+
var model = new SelfAssessmentReportsViewModel(selfAssessmentReportService.GetSelfAssessmentsForReportList((int)centreId, adminCategoryId), adminCategoryId, categoryId, showTableauLink);
5665
return View(model);
5766
}
5867
[HttpGet]
@@ -84,19 +93,22 @@ public IActionResult DownloadSelfAssessmentReport(int selfAssessmentId)
8493
}
8594
[HttpGet]
8695
[Route("TableauCompetencyDashboard")]
87-
public IActionResult TableauCompetencyDashboard()
96+
public async Task<IActionResult> TableauCompetencyDashboardAsync()
8897
{
8998
var userEmail = User.GetUserPrimaryEmail();
9099
var adminId = User.GetAdminId();
91100
var jwt = tableauConnectionHelper.GetTableauJwt();
101+
var tableauFlag = await featureManager.IsEnabledAsync(FeatureFlags.TableauSelfAssessmentDashboards);
102+
var tableauQueryOverride = string.Equals(Request.Query["tableaulink"], "true", StringComparison.OrdinalIgnoreCase);
103+
var showTableauLink = tableauFlag || tableauQueryOverride;
92104
ViewBag.Email = userEmail;
93105
ViewBag.AdminId = adminId;
94106
ViewBag.SiteName = tableauSiteName;
95107
ViewBag.TableauServerUrl = tableauUrl;
96108
ViewBag.WorkbookName = workbookName;
97109
ViewBag.ViewName = viewName;
98110
ViewBag.JwtToken = jwt;
99-
111+
ViewBag.ShowTableauLink = showTableauLink;
100112
return View();
101113
}
102114
}

DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Centre/Reports/SelfAssessmentReportsViewModel.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@
66
public class SelfAssessmentReportsViewModel
77
{
88
public SelfAssessmentReportsViewModel(
9-
IEnumerable<SelfAssessmentSelect> selfAssessmentSelects, int? adminCategoryId, int categoryId
9+
IEnumerable<SelfAssessmentSelect> selfAssessmentSelects, int? adminCategoryId, int categoryId, bool showTableauLink
1010
)
1111
{
1212
SelfAssessmentSelects = selfAssessmentSelects;
1313
AdminCategoryId = adminCategoryId;
1414
CategoryId = categoryId;
15+
ShowTableauLink = showTableauLink;
1516
}
1617
public IEnumerable<SelfAssessmentSelect> SelfAssessmentSelects { get; set; }
1718
public int? AdminCategoryId { get; set; }
1819
public int CategoryId { get; set; }
20+
public bool ShowTableauLink { get; set; } = false;
1921
}
2022
}

0 commit comments

Comments
 (0)