Skip to content

Commit 8f92d30

Browse files
committed
Merge branch 'DLS-Release-v1.1.1' into UAT
2 parents 05a4579 + 40cfeb7 commit 8f92d30

File tree

5 files changed

+47
-17
lines changed

5 files changed

+47
-17
lines changed

DigitalLearningSolutions.Data/DataServices/SupervisorDataService.cs

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,35 @@ public SupervisorDataService(IDbConnection connection, ILogger<SupervisorDataSer
126126
public DashboardData? GetDashboardDataForAdminId(int adminId)
127127
{
128128
return connection.Query<DashboardData>(
129-
@" SELECT (SELECT COUNT(sd.ID) AS StaffCount
130-
FROM SupervisorDelegates sd
131-
LEFT OUTER JOIN users u
132-
ON u.id = sd.DelegateUserID
133-
AND u.Active = 1
134-
WHERE (sd.SupervisorAdminID = @adminId)
135-
AND (sd.Removed IS NULL)) AS StaffCount,
129+
@"SELECT (SELECT COUNT(sd.ID) AS StaffCount
130+
FROM CustomPrompts AS cp6
131+
RIGHT OUTER JOIN CustomPrompts AS cp5
132+
RIGHT OUTER JOIN DelegateAccounts AS da
133+
RIGHT OUTER JOIN SupervisorDelegates AS sd
134+
INNER JOIN AdminUsers AS au
135+
ON sd.SupervisorAdminID = au.AdminID
136+
INNER JOIN Centres AS ct
137+
ON au.CentreID = ct.CentreID
138+
ON da.CentreID = ct.CentreID
139+
AND da.UserID = sd.DelegateUserID
140+
LEFT OUTER JOIN Users AS u
141+
LEFT OUTER JOIN JobGroups AS jg
142+
ON u.JobGroupID = jg.JobGroupID
143+
ON da.UserID = u.ID
144+
LEFT OUTER JOIN CustomPrompts AS cp1
145+
ON ct.CustomField1PromptID = cp1.CustomPromptID
146+
LEFT OUTER JOIN CustomPrompts AS cp2
147+
ON ct.CustomField2PromptID = cp2.CustomPromptID
148+
LEFT OUTER JOIN CustomPrompts AS cp3
149+
ON ct.CustomField3PromptID = cp3.CustomPromptID
150+
LEFT OUTER JOIN CustomPrompts AS cp4
151+
ON ct.CustomField4PromptID = cp4.CustomPromptID
152+
ON cp5.CustomPromptID = ct.CustomField5PromptID
153+
ON cp6.CustomPromptID = ct.CustomField6PromptID
154+
LEFT OUTER JOIN AdminAccounts AS au2
155+
ON da.UserID = au2.UserID AND da.CentreID = au2.CentreID
156+
WHERE (sd.SupervisorAdminID = @adminId) AND (sd.Removed IS NULL) AND
157+
(u.ID = da.UserID OR sd.DelegateUserID IS NULL)) AS StaffCount,
136158
(SELECT COUNT(ID) AS StaffCount
137159
FROM SupervisorDelegates AS SupervisorDelegates_1
138160
WHERE (SupervisorAdminID = @adminId)

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using System.Threading.Tasks;
1616
using Microsoft.Extensions.Configuration;
1717
using DigitalLearningSolutions.Data.Extensions;
18+
using DigitalLearningSolutions.Web.Services;
1819

1920
[FeatureGate(FeatureFlags.RefactoredTrackingSystem)]
2021
[Authorize(Policy = CustomPolicies.UserCentreAdmin)]
@@ -30,11 +31,13 @@ public class SelfAssessmentReportsController : Controller
3031
private readonly string tableauSiteName;
3132
private readonly string workbookName;
3233
private readonly string viewName;
34+
private readonly ISelfAssessmentService selfAssessmentService;
3335
public SelfAssessmentReportsController(
3436
ISelfAssessmentReportService selfAssessmentReportService,
3537
ITableauConnectionHelperService tableauConnectionHelper,
3638
IClockUtility clockUtility,
37-
IConfiguration config
39+
IConfiguration config,
40+
ISelfAssessmentService selfAssessmentService
3841
)
3942
{
4043
this.selfAssessmentReportService = selfAssessmentReportService;
@@ -44,12 +47,14 @@ IConfiguration config
4447
tableauSiteName = config.GetTableauSiteName();
4548
workbookName = config.GetTableauWorkbookName();
4649
viewName = config.GetTableauViewName();
50+
this.selfAssessmentService = selfAssessmentService;
4751
}
4852
public IActionResult Index()
4953
{
5054
var centreId = User.GetCentreId();
51-
var categoryId = User.GetAdminCategoryId();
52-
var model = new SelfAssessmentReportsViewModel(selfAssessmentReportService.GetSelfAssessmentsForReportList((int)centreId, categoryId));
55+
var adminCategoryId = User.GetAdminCategoryId();
56+
var categoryId = this.selfAssessmentService.GetSelfAssessmentCategoryId(1);
57+
var model = new SelfAssessmentReportsViewModel(selfAssessmentReportService.GetSelfAssessmentsForReportList((int)centreId, adminCategoryId), adminCategoryId, categoryId);
5358
return View(model);
5459
}
5560
[HttpGet]

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@
66
public class SelfAssessmentReportsViewModel
77
{
88
public SelfAssessmentReportsViewModel(
9-
IEnumerable<SelfAssessmentSelect> selfAssessmentSelects
9+
IEnumerable<SelfAssessmentSelect> selfAssessmentSelects, int? adminCategoryId, int categoryId
1010
)
1111
{
1212
SelfAssessmentSelects = selfAssessmentSelects;
13+
AdminCategoryId = adminCategoryId;
14+
CategoryId = categoryId;
1315
}
1416
public IEnumerable<SelfAssessmentSelect> SelfAssessmentSelects { get; set; }
17+
public int? AdminCategoryId { get; set; }
18+
public int CategoryId { get; set; }
1519
}
1620
}

DigitalLearningSolutions.Web/Views/Supervisor/ReviewCompetencySelfAsessment.cshtml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,11 @@
122122
}
123123
@if (Model.Competency.AssessmentQuestions.First().IncludeComments)
124124
{
125-
var promptText = string.IsNullOrEmpty(Model.Competency.AssessmentQuestions.First()?.CommentsPrompt) ?
125+
var commentsLabel = string.IsNullOrEmpty(Model.Competency.AssessmentQuestions.First()?.CommentsPrompt) ?
126126
Model.DelegateSelfAssessment.ReviewerCommentsLabel : Model.Competency.AssessmentQuestions.First()?.CommentsPrompt;
127127
<div class="nhsuk-summary-list__row">
128128
<dt class="nhsuk-summary-list__key">
129-
@(((Model.Competency.AssessmentQuestions.First().SignedOff == true && Model.Competency.AssessmentQuestions.First().Verified.HasValue)
130-
|| (Model.Competency.AssessmentQuestions.First().ResultId != null && Model.Competency.AssessmentQuestions.First().Verified == null && Model.Competency.AssessmentQuestions.First().Requested != null && Model.Competency.AssessmentQuestions.First().UserIsVerifier == false)
131-
|| (Model.Competency.AssessmentQuestions.First().Verified == null && Model.Competency.AssessmentQuestions.First().Requested != null)
132-
&& (!String.IsNullOrEmpty(Model.DelegateSelfAssessment.ReviewerCommentsLabel)))
133-
? promptText : "Comments")
129+
@(!String.IsNullOrEmpty(commentsLabel) ? commentsLabel : "Comments")
134130
</dt>
135131
<dd class="nhsuk-summary-list__value">
136132
@Html.Raw(Model.Competency.AssessmentQuestions.First().SupportingComments)

DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/SelfAssessmentReports/Index.cshtml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,13 @@
2828
<h2>Excel learner activity reports</h2>
2929
<p class="nhsuk-lede-text">Download Excel competency self assessments activity reports for your centre.</p>
3030
<ul>
31+
@if((Model.AdminCategoryId == null) || (Model.AdminCategoryId == Model.CategoryId))
32+
{
3133
<li>
3234
<a asp-controller="SelfAssessmentReports" asp-action="DownloadDigitalCapabilityToExcel">Digital Skills Assessment Tool - Download report</a>
3335

3436
</li>
37+
}
3538
@if (Model.SelfAssessmentSelects.Any())
3639
{
3740
@foreach (var report in Model.SelfAssessmentSelects)

0 commit comments

Comments
 (0)