Skip to content

Commit 5d97543

Browse files
Merge branch 'Release-2024.32' into Develop/feature/TD-3921-RegistrationPromptsController-refactor
2 parents 84fb660 + 0e0c241 commit 5d97543

File tree

7 files changed

+90
-75
lines changed

7 files changed

+90
-75
lines changed

DigitalLearningSolutions.Data/DataServices/SupervisorDataService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ public IEnumerable<SupervisorDashboardToDoItem> GetSupervisorDashboardToDoItemsF
560560
AND sasv.CandidateAssessmentSupervisorID = cas.ID AND sar.DateTime = (
561561
SELECT TOP 1 sar2.DateTime
562562
FROM SelfAssessmentResults AS sar2
563-
WHERE sar2.SelfAssessmentID = sar.SelfAssessmentID AND sar2.CompetencyID = co.ID AND sar2.Result != 0 ORDER BY sar2.ID DESC
563+
WHERE sar2.ID = sar.ID AND sar2.SelfAssessmentID = sar.SelfAssessmentID AND sar2.CompetencyID = co.ID AND sar2.Result != 0 ORDER BY sar2.ID DESC
564564
)
565565
WHERE (sd.SupervisorAdminID = @adminId) AND (cas.Removed IS NULL) AND (sasv.Verified IS NULL) AND (sd.Removed IS NULL)
566566
GROUP BY sa.ID, ca.ID, sd.ID, u.FirstName, u.LastName, sa.Name,cast(sasv.Requested as date)", new { adminId }

DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/Dashboard/ContractDetailsController.cs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
namespace DigitalLearningSolutions.Web.Controllers.TrackingSystem.Centre.Dashboard
22
{
3-
using DigitalLearningSolutions.Data.DataServices;
4-
using DigitalLearningSolutions.Data.DataServices.UserDataService;
53
using DigitalLearningSolutions.Data.Enums;
64
using DigitalLearningSolutions.Web.Attributes;
75
using DigitalLearningSolutions.Web.Helpers;
86
using DigitalLearningSolutions.Web.Models.Enums;
7+
using DigitalLearningSolutions.Web.Services;
98
using DigitalLearningSolutions.Web.ViewModels.TrackingSystem.Centre.ContractDetails;
109
using Microsoft.AspNetCore.Authorization;
1110
using Microsoft.AspNetCore.Mvc;
@@ -18,27 +17,27 @@
1817
[Route("/TrackingSystem/Centre/ContractDetails")]
1918
public class ContractDetailsController : Controller
2019
{
21-
private readonly ICentresDataService centresDataService;
22-
private readonly ICourseDataService courseDataService;
23-
private readonly IUserDataService userDataService;
20+
private readonly ICentresService centresService;
21+
private readonly ICourseService courseService;
22+
private readonly IUserService userService;
2423

2524
public ContractDetailsController(
26-
ICentresDataService centresDataService,
27-
IUserDataService userDataService,
28-
ICourseDataService courseDataService
25+
ICentresService centresService,
26+
IUserService userService,
27+
ICourseService courseService
2928
)
3029
{
31-
this.centresDataService = centresDataService;
32-
this.userDataService = userDataService;
33-
this.courseDataService = courseDataService;
30+
this.centresService = centresService;
31+
this.userService = userService;
32+
this.courseService = courseService;
3433
}
3534

3635
public IActionResult Index()
3736
{
3837
var centreId = User.GetCentreIdKnownNotNull();
39-
var centreDetails = centresDataService.GetCentreDetailsById(centreId)!;
40-
var adminUsersAtCentre = userDataService.GetAdminUsersByCentreId(centreId);
41-
var numberOfCourses = courseDataService.GetNumberOfActiveCoursesAtCentreFilteredByCategory(centreId, null);
38+
var centreDetails = centresService.GetCentreDetailsById(centreId)!;
39+
var adminUsersAtCentre = userService.GetAdminUsersByCentreId(centreId);
40+
var numberOfCourses = courseService.GetNumberOfActiveCoursesAtCentreFilteredByCategory(centreId, null);
4241

4342
var model = new ContractDetailsViewModel(adminUsersAtCentre, centreDetails, numberOfCourses);
4443

DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/Dashboard/RankingController.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
namespace DigitalLearningSolutions.Web.Controllers.TrackingSystem.Centre.Dashboard
22
{
3-
using DigitalLearningSolutions.Data.DataServices;
43
using DigitalLearningSolutions.Data.Enums;
54
using DigitalLearningSolutions.Web.Attributes;
65
using DigitalLearningSolutions.Web.Helpers;
@@ -19,15 +18,15 @@
1918
public class RankingController : Controller
2019
{
2120
private readonly ICentresService centresService;
22-
private readonly IRegionDataService regionDataService;
21+
private readonly IRegionService regionService;
2322

2423
public RankingController(
2524
ICentresService centresService,
26-
IRegionDataService regionDataService
25+
IRegionService regionService
2726
)
2827
{
2928
this.centresService = centresService;
30-
this.regionDataService = regionDataService;
29+
this.regionService = regionService;
3130
}
3231

3332
public IActionResult Index(int? regionId = null, Period? period = null)
@@ -36,7 +35,7 @@ public IActionResult Index(int? regionId = null, Period? period = null)
3635

3736
var centreId = User.GetCentreIdKnownNotNull();
3837

39-
var regions = regionDataService.GetRegionsAlphabetical();
38+
var regions = regionService.GetRegionsAlphabetical();
4039

4140
var centreRankings = centresService.GetCentresForCentreRankingPage(centreId, period.Days, regionId);
4241

DigitalLearningSolutions.Web/Services/CentresService.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ void UpdateCentreManagerDetails(
4343
string? GetCentreName(int centreId);
4444
IEnumerable<(int, string)> GetCentresForDelegateSelfRegistrationAlphabetical();
4545
(bool autoRegistered, string? autoRegisterManagerEmail) GetCentreAutoRegisterValues(int centreId);
46+
Centre? GetCentreDetailsById(int centreId);
4647
}
4748

4849
public class CentresService : ICentresService
@@ -148,5 +149,10 @@ public void UpdateCentreManagerDetails(int centreId, string firstName, string la
148149
{
149150
return centresDataService.GetCentreAutoRegisterValues(centreId);
150151
}
152+
153+
public Centre? GetCentreDetailsById(int centreId)
154+
{
155+
return centresDataService.GetCentreDetailsById(centreId);
156+
}
151157
}
152158
}

DigitalLearningSolutions.Web/Services/CourseService.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ int diagCompletionThreshold
130130
IEnumerable<CompletedCourse> GetCompletedCourses(int candidateId);
131131
IEnumerable<AvailableCourse> GetAvailableCourses(int candidateId, int? centreId);
132132
void EnrolOnSelfAssessment(int selfAssessmentId, int delegateUserId, int centreId);
133+
int GetNumberOfActiveCoursesAtCentreFilteredByCategory(int centreId, int? categoryId);
133134
}
134135

135136
public class CourseService : ICourseService
@@ -607,5 +608,10 @@ public void EnrolOnSelfAssessment(int selfAssessmentId, int delegateUserId, int
607608
{
608609
courseDataService.EnrolSelfAssessment(selfAssessmentId, delegateUserId, centreId);
609610
}
611+
612+
public int GetNumberOfActiveCoursesAtCentreFilteredByCategory(int centreId, int? categoryId)
613+
{
614+
return courseDataService.GetNumberOfActiveCoursesAtCentreFilteredByCategory(centreId, categoryId);
615+
}
610616
}
611617
}

DigitalLearningSolutions.Web/Services/UserService.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ string registrationConfirmationHash
144144
DelegateAccount? GetDelegateAccountById(int id);
145145
int? GetUserIdFromUsername(string username);
146146
int GetDelegateCountWithAnswerForPrompt(int centreId, int promptNumber);
147+
List<AdminUser> GetAdminUsersByCentreId(int centreId);
147148
}
148149

149150
public class UserService : IUserService
@@ -797,5 +798,9 @@ public int GetDelegateCountWithAnswerForPrompt(int centreId, int promptNumber)
797798
{
798799
return userDataService.GetDelegateCountWithAnswerForPrompt(centreId, promptNumber);
799800
}
801+
public List<AdminUser> GetAdminUsersByCentreId(int centreId)
802+
{
803+
return userDataService.GetAdminUsersByCentreId(centreId);
804+
}
800805
}
801806
}

DigitalLearningSolutions.Web/Views/Frameworks/Developer/_Structure.cshtml

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -3,86 +3,86 @@
33
<h2>Framework structure</h2>
44
@if (Model.FrameworkCompetencyGroups.Any())
55
{
6-
foreach (var frameworkCompetencyGroup in Model.FrameworkCompetencyGroups)
7-
{
8-
<partial name="../Shared/_CompetencyGroupCard.cshtml" model="new CompetencyGroupCardViewModel
6+
foreach (var frameworkCompetencyGroup in Model.FrameworkCompetencyGroups)
7+
{
8+
<partial name="../Shared/_CompetencyGroupCard.cshtml" model="new CompetencyGroupCardViewModel
99
{
1010
CanModify = Model.DetailFramework.UserRole > 1,
1111
FrameworkCompetencyGroup =frameworkCompetencyGroup,
1212
CompetencyFlags = Model.CompetencyFlags
1313
}"
14-
view-data='@new ViewDataDictionary(ViewData)
14+
view-data='new ViewDataDictionary(ViewData)
1515
{
16-
{ "VocabSingular", @Model.VocabSingular() },
17-
{ "VocabPlural", @Model.VocabPlural() },
18-
{ "GroupCount", @Model.FrameworkCompetencyGroups.Count() }
16+
{ "VocabSingular", Model.VocabSingular() },
17+
{ "VocabPlural", Model.VocabPlural() },
18+
{ "GroupCount", Model.FrameworkCompetencyGroups.Count() }
1919
}' />
20-
}
20+
}
2121
}
2222
else
2323
{
24-
@if (!Model.FrameworkCompetencies.Any())
25-
{
26-
<div class="nhsuk-warning-callout callout-green">
27-
<h3 class="nhsuk-warning-callout__label">
28-
<span role="text">
29-
This is an empty framework.
30-
</span>
31-
</h3>
32-
@if (Model.DetailFramework.UserRole <= 1)
33-
{
34-
<p>This framework doesn't contain any @Model.VocabSingular().ToLower() groups or @Model.VocabPlural().ToLower().</p>
35-
}
36-
@if (Model.DetailFramework.UserRole > 1)
37-
{
38-
<p>Start adding @Model.VocabSingular().ToLower() groups and @Model.VocabPlural().ToLower() to this framework using the buttons below.</p>
39-
<p>Use the <strong>Details</strong> tab above to view and edit the framework details and working group.</p>
40-
}
41-
@if (Model.DetailFramework.UserRole > 0)
42-
{
43-
<p>Use the <strong>Comments</strong> tab to view, add and respond to comments from working group members on this framework.</p>
44-
}
45-
@if (Model.DetailFramework.UserRole > 1)
46-
{
47-
<p>When you are ready, use the <strong>Send for Review</strong> button above to request review and sign off of your framework.</p>
48-
}
49-
</div>
50-
}
51-
else
52-
{
53-
<p>No @Model.VocabSingular().ToLower() groups in this framework.</p>
54-
}
24+
@if (!Model.FrameworkCompetencies.Any())
25+
{
26+
<div class="nhsuk-warning-callout callout-green">
27+
<h3 class="nhsuk-warning-callout__label">
28+
<span role="text">
29+
This is an empty framework.
30+
</span>
31+
</h3>
32+
@if (Model.DetailFramework.UserRole <= 1)
33+
{
34+
<p>This framework doesn't contain any @Model.VocabSingular().ToLower() groups or @Model.VocabPlural().ToLower().</p>
35+
}
36+
@if (Model.DetailFramework.UserRole > 1)
37+
{
38+
<p>Start adding @Model.VocabSingular().ToLower() groups and @Model.VocabPlural().ToLower() to this framework using the buttons below.</p>
39+
<p>Use the <strong>Details</strong> tab above to view and edit the framework details and working group.</p>
40+
}
41+
@if (Model.DetailFramework.UserRole > 0)
42+
{
43+
<p>Use the <strong>Comments</strong> tab to view, add and respond to comments from working group members on this framework.</p>
44+
}
45+
@if (Model.DetailFramework.UserRole > 1)
46+
{
47+
<p>When you are ready, use the <strong>Send for Review</strong> button above to request review and sign off of your framework.</p>
48+
}
49+
</div>
50+
}
51+
else
52+
{
53+
<p>No @Model.VocabSingular().ToLower() groups in this framework.</p>
54+
}
5555
}
5656
<div id="fc-ungrouped">
57-
@if (Model.FrameworkCompetencies.Any())
58-
{
59-
60-
foreach (var frameworkCompetency in Model.FrameworkCompetencies)
57+
@if (Model.FrameworkCompetencies.Any())
6158
{
62-
<partial name="../Shared/_CompetencyCard.cshtml" model="new CompetencyCardViewModel()
59+
60+
foreach (var frameworkCompetency in Model.FrameworkCompetencies)
61+
{
62+
<partial name="../Shared/_CompetencyCard.cshtml" model="new CompetencyCardViewModel()
6363
{
6464
CanModify = Model.DetailFramework.UserRole > 1,
6565
FrameworkCompetencyGroupId = null,
6666
FrameworkCompetency = frameworkCompetency,
6767
CompetencyFlags = Model.CompetencyFlags.Where(c => c.CompetencyId == frameworkCompetency.CompetencyID)
6868
}"
69-
view-data='@new ViewDataDictionary(ViewData)
69+
view-data='new ViewDataDictionary(ViewData)
7070
{
71-
{ "VocabSingular", @Model.VocabSingular() },
72-
{"VocabPlural", @Model.VocabPlural() }
71+
{ "VocabSingular", Model.VocabSingular() },
72+
{"VocabPlural", Model.VocabPlural() }
7373
}' />
74-
}
74+
}
7575

76-
}
76+
}
7777
</div>
7878
@if (Model.DetailFramework.UserRole > 1)
7979
{
80-
<div class="nhsuk-grid-row nhsuk-u-margin-top-3">
81-
<div class="nhsuk-grid-column-full">
82-
<a class="nhsuk-button" asp-action="AddEditFrameworkCompetencyGroup" asp-route-frameworkId="@(ViewContext.RouteData.Values["frameworkId"])">Add @Model.VocabSingular().ToLower() group</a>
83-
<a class="nhsuk-button nhsuk-button--secondary" asp-action="AddEditFrameworkCompetency" asp-route-frameworkId="@(ViewContext.RouteData.Values["frameworkId"])">Add ungrouped @Model.VocabSingular().ToLower()</a>
84-
<a class="nhsuk-button nhsuk-button--secondary" asp-action="ImportCompetencies" asp-route-frameworkId="@(ViewContext.RouteData.Values["frameworkId"])" asp-route-tabname="@(ViewContext.RouteData.Values["tabname"])">Import @Model.VocabPlural().ToLower() from Excel</a>
80+
<div class="nhsuk-grid-row nhsuk-u-margin-top-3">
81+
<div class="nhsuk-grid-column-full">
82+
<a class="nhsuk-button" asp-action="AddEditFrameworkCompetencyGroup" asp-route-frameworkId="@(ViewContext.RouteData.Values["frameworkId"])">Add @Model.VocabSingular().ToLower() group</a>
83+
<a class="nhsuk-button nhsuk-button--secondary" asp-action="AddEditFrameworkCompetency" asp-route-frameworkId="@(ViewContext.RouteData.Values["frameworkId"])">Add ungrouped @Model.VocabSingular().ToLower()</a>
84+
<a class="nhsuk-button nhsuk-button--secondary" asp-action="ImportCompetencies" asp-route-frameworkId="@(ViewContext.RouteData.Values["frameworkId"])" asp-route-tabname="@(ViewContext.RouteData.Values["tabname"])">Import @Model.VocabPlural().ToLower() from Excel</a>
85+
</div>
8586
</div>
86-
</div>
8787
}
8888

0 commit comments

Comments
 (0)