Skip to content

Commit 7cb2ca2

Browse files
committed
Merge branch 'DLS-Release-v1.2.1' into UAT
2 parents 2a57889 + 7cacd96 commit 7cb2ca2

File tree

23 files changed

+665
-440
lines changed

23 files changed

+665
-440
lines changed

DigitalLearningSolutions.Data/DataServices/FrameworkDataService.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,9 +1882,20 @@ FROM Competencies AS C INNER JOIN
18821882
public int GetAdminUserRoleForFrameworkId(int adminId, int frameworkId)
18831883
{
18841884
return connection.QuerySingle<int>(
1885-
@"SELECT CASE WHEN FW.OwnerAdminID = @adminId THEN 3 WHEN COALESCE (fwc.CanModify, 0) = 1 THEN 2 WHEN COALESCE (fwc.CanModify, 0) = 0 THEN 1 ELSE 0 END AS UserRole
1886-
FROM Frameworks AS FW LEFT OUTER JOIN
1887-
FrameworkCollaborators AS fwc ON fwc.FrameworkID = FW.ID AND fwc.AdminID = @adminId AND fwc.IsDeleted = 0
1885+
@"SELECT CASE
1886+
WHEN (aa.UserID = (SELECT UserID FROM AdminAccounts WHERE ID = @adminId)) THEN 3
1887+
WHEN (fwc.CanModify = 1) OR
1888+
(SELECT COUNT(*)
1889+
FROM FrameworkCollaborators fc
1890+
JOIN AdminAccounts aa1 ON fc.AdminID = aa1.ID
1891+
WHERE fc.FrameworkID = fw.ID
1892+
AND fc.CanModify = 1 AND fc.IsDeleted = 0
1893+
AND aa1.UserID = (SELECT aa2.UserID FROM AdminAccounts aa2 WHERE aa2.ID = @adminId)) > 0 THEN 2
1894+
WHEN fwc.CanModify = 0 THEN 1 ELSE 0
1895+
END AS UserRole
1896+
FROM Frameworks AS FW INNER JOIN
1897+
AdminAccounts AS aa ON aa.ID = fw.OwnerAdminID LEFT OUTER JOIN
1898+
FrameworkCollaborators AS fwc ON fwc.FrameworkID = FW.ID AND fwc.AdminID = @adminId AND fwc.IsDeleted = 0
18881899
WHERE (FW.ID = @frameworkId)",
18891900
new { adminId, frameworkId }
18901901
);

DigitalLearningSolutions.Data/DataServices/SelfAssessmentDataService/SelfAsssessmentReportDataService.cs

Lines changed: 139 additions & 135 deletions
Large diffs are not rendered by default.

DigitalLearningSolutions.Data/DataServices/UserDataService/DelegateUserCardDataService.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,8 @@ public List<DelegateUserCard> GetDelegateUserCardsForExportByCentreId(String sea
352352

353353
if (sortBy == "SearchableName")
354354
orderBy = " ORDER BY LTRIM(LastName) " + sortDirection + ", LTRIM(FirstName) ";
355+
else if(sortBy == "LastAccessed")
356+
orderBy = " ORDER BY LastAccessed " + sortDirection;
355357
else
356358
orderBy = " ORDER BY DateRegistered " + sortDirection;
357359

DigitalLearningSolutions.Data/Helpers/GenericSortingHelper.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ public static class DelegateSortByOptions
250250
public static readonly (string DisplayText, string PropertyName) Name =
251251
("Name", nameof(DelegateUserCard.SearchableName));
252252

253+
public static readonly (string DisplayText, string PropertyName) LastAccessed =
254+
("Last accessed date", nameof(DelegateUserCard.LastAccessed));
255+
253256
public static readonly (string DisplayText, string PropertyName) RegistrationDate =
254257
("Registration Date", nameof(DelegateUserCard.DateRegistered));
255258
}
Lines changed: 41 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,41 @@
1-
namespace DigitalLearningSolutions.Data.Models.SelfAssessments.Export
2-
{
3-
using System;
4-
public class SelfAssessmentReportData
5-
{
6-
public string? SelfAssessment { get; set; }
7-
public string? Learner { get; set; }
8-
public bool LearnerActive { get; set; }
9-
public string? PRN { get; set; }
10-
public string? JobGroup { get; set; }
11-
public string? ProgrammeCourse { get; set; }
12-
public string? Organisation { get; set; }
13-
public string? DepartmentTeam { get; set; }
14-
public string? OtherCentres { get; set; }
15-
public string? DLSRole { get; set; }
16-
public DateTime? Registered { get; set; }
17-
public DateTime? Started { get; set; }
18-
public DateTime? LastAccessed { get; set; }
19-
public int? OptionalProficienciesAssessed { get; set; }
20-
public int? SelfAssessedAchieved { get; set; }
21-
public int? ConfirmedResults { get; set; }
22-
public DateTime? SignOffRequested { get; set; }
23-
public bool SignOffAchieved { get; set; }
24-
public DateTime? ReviewedDate { get; set; }
25-
}
26-
}
1+
namespace DigitalLearningSolutions.Data.Models.SelfAssessments.Export
2+
{
3+
using System;
4+
public class SelfAssessmentReportData
5+
{
6+
public string? SelfAssessment { get; set; }
7+
public string? Learner { get; set; }
8+
public bool LearnerActive { get; set; }
9+
public string? PRN { get; set; }
10+
public string? JobGroup { get; set; }
11+
public string? RegistrationAnswer1 { get; set; }
12+
public string? RegistrationAnswer2 { get; set; }
13+
public string? RegistrationAnswer3 { get; set; }
14+
public string? RegistrationAnswer4 { get; set; }
15+
public string? RegistrationAnswer5 { get; set; }
16+
public string? RegistrationAnswer6 { get; set; }
17+
public string? OtherCentres { get; set; }
18+
public string? DLSRole { get; set; }
19+
public DateTime? Registered { get; set; }
20+
public DateTime? Started { get; set; }
21+
public DateTime? LastAccessed { get; set; }
22+
public int? OptionalProficienciesAssessed { get; set; }
23+
public int? SelfAssessedAchieved { get; set; }
24+
public int? ConfirmedResults { get; set; }
25+
public DateTime? SignOffRequested { get; set; }
26+
public bool SignOffAchieved { get; set; }
27+
public DateTime? ReviewedDate { get; set; }
28+
29+
// we need this for iteration across the registration answers from Delegate Accounts which match the custom fields of Centres.
30+
public string?[] CentreRegistrationPrompts =>
31+
new[]
32+
{
33+
RegistrationAnswer1,
34+
RegistrationAnswer2,
35+
RegistrationAnswer3,
36+
RegistrationAnswer4,
37+
RegistrationAnswer5,
38+
RegistrationAnswer6,
39+
};
40+
}
41+
}

DigitalLearningSolutions.Web/Controllers/FrameworksController/AssessmentQuestions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ public IActionResult EditAssessmentQuestionOptions(AssessmentQuestionDetail asse
456456
return RedirectToAction("EditAssessmentQuestionOptions", "Frameworks", new { frameworkId, assessmentQuestionId, frameworkCompetencyId });
457457
}
458458
assessmentQuestionDetail.ScoringInstructions = SanitizerHelper.SanitizeHtmlData(assessmentQuestionDetail.ScoringInstructions);
459+
if (string.IsNullOrWhiteSpace(StringHelper.StripHtmlTags(assessmentQuestionDetail?.ScoringInstructions))) { assessmentQuestionDetail.ScoringInstructions = null; }
459460
SessionAssessmentQuestion sessionAssessmentQuestion = multiPageFormService
460461
.GetMultiPageFormData<SessionAssessmentQuestion>(MultiPageFormDataFeature.EditAssessmentQuestion, TempData)
461462
.GetAwaiter()

DigitalLearningSolutions.Web/Controllers/FrameworksController/Competencies.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public IActionResult AddEditFrameworkCompetencyGroup(int frameworkId, Competency
6565
var adminId = GetAdminId();
6666
var userRole = frameworkService.GetAdminUserRoleForFrameworkId(adminId, frameworkId);
6767
if (userRole < 2) return StatusCode(403);
68+
if (string.IsNullOrWhiteSpace(StringHelper.StripHtmlTags(competencyGroupBase?.Description))) { competencyGroupBase.Description = null; }
6869
if (competencyGroupBase.ID > 0)
6970
{
7071
frameworkService.UpdateFrameworkCompetencyGroup(frameworkCompetencyGroupId, competencyGroupBase.CompetencyGroupID, competencyGroupBase.Name, SanitizerHelper.SanitizeHtmlData
@@ -141,7 +142,7 @@ public IActionResult AddEditFrameworkCompetency(int frameworkId, FrameworkCompet
141142
frameworkCompetency.Description?.Trim();
142143
var description = HttpUtility.HtmlDecode(HttpUtility.HtmlDecode(frameworkCompetency.Description));
143144
var detailFramework = frameworkService.GetDetailFrameworkByFrameworkId(frameworkId, GetAdminId());
144-
if (string.IsNullOrWhiteSpace(description)) { frameworkCompetency.Description = null; }
145+
if (string.IsNullOrWhiteSpace(StringHelper.StripHtmlTags(description))) { frameworkCompetency.Description = null; }
145146
if (!ModelState.IsValid)
146147
{
147148
ModelState.Remove(nameof(FrameworkCompetency.Name));

DigitalLearningSolutions.Web/Services/DelegateDownloadFileService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class DelegateDownloadFileService : IDelegateDownloadFileService
3939
private const string ProfessionalRegistrationNumber = "Professional Registration Number";
4040
private const string JobGroup = "Job group";
4141
private const string RegisteredDate = "Registered";
42-
private const string LastAccessed = "Last Accessed";
42+
private const string LastAccessed = "Last Accessed Date";
4343
private const string RegistrationComplete = "Registration complete";
4444
private const string Active = "Active";
4545
private const string Approved = "Approved";

0 commit comments

Comments
 (0)