Skip to content

Commit 2c359b4

Browse files
authored
Merge branch 'Release-DLS-2023.23' into Develop/Features/TD-1565-ImplementationOfCompleteByEditLink
2 parents b556f01 + 1394d11 commit 2c359b4

File tree

10 files changed

+46
-35
lines changed

10 files changed

+46
-35
lines changed

DigitalLearningSolutions.Data/DataServices/SelfAssessmentDataService/CandidateAssessmentsDataService.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ FROM SelfAssessmentSupervisorRoles AS SelfAssessmentSupervisorRoles_1
9898
'Supervisor') AS SignOffRoleName,
9999
SA.SignOffRequestorStatement,
100100
SA.ManageSupervisorsDescription,
101-
CA.NonReportable
101+
CA.NonReportable,
102+
U.FirstName +' '+ U.LastName AS DelegateName
102103
FROM CandidateAssessments CA
103104
JOIN SelfAssessments SA
104105
ON CA.SelfAssessmentID = SA.ID
@@ -110,6 +111,8 @@ INNER JOIN CompetencyGroups AS CG
110111
ON SAS.CompetencyGroupID = CG.ID AND SAS.SelfAssessmentID = @selfAssessmentId
111112
LEFT OUTER JOIN CandidateAssessmentOptionalCompetencies AS CAOC
112113
ON CA.ID = CAOC.CandidateAssessmentID AND C.ID = CAOC.CompetencyID AND CG.ID = CAOC.CompetencyGroupID
114+
INNER JOIN Users AS U
115+
ON U.ID = CA.DelegateUserID
113116
WHERE CA.DelegateUserID = @delegateUserId AND CA.SelfAssessmentID = @selfAssessmentId AND CA.RemovedDate IS NULL
114117
AND CA.CompletedDate IS NULL AND ((SAS.Optional = 0) OR (CAOC.IncludedInSelfAssessment = 1))
115118
GROUP BY
@@ -120,7 +123,8 @@ GROUP BY
120123
CA.ID, CA.UserBookmark, CA.UnprocessedUpdates,
121124
CA.LaunchCount, CA.SubmittedDate, SA.LinearNavigation, SA.UseDescriptionExpanders,
122125
SA.ManageOptionalCompetenciesPrompt, SA.SupervisorSelfAssessmentReview, SA.SupervisorResultsReview,
123-
SA.ReviewerCommentsLabel,SA.EnforceRoleRequirementsForSignOff, SA.ManageSupervisorsDescription,CA.NonReportable",
126+
SA.ReviewerCommentsLabel,SA.EnforceRoleRequirementsForSignOff, SA.ManageSupervisorsDescription,CA.NonReportable,
127+
U.FirstName , U.LastName",
124128
new { delegateUserId, selfAssessmentId }
125129
);
126130
}

DigitalLearningSolutions.Data/DataServices/SelfAssessmentDataService/DCSAReportDataService.cs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
public interface IDCSAReportDataService
1010
{
11-
IEnumerable<DCSADelegateCompletionStatus> GetDelegateCompletionStatusForCentre(int centreId);
12-
IEnumerable<DCSAOutcomeSummary> GetOutcomeSummaryForCentre(int centreId);
11+
IEnumerable<DCSADelegateCompletionStatus> GetDelegateCompletionStatus();
12+
IEnumerable<DCSAOutcomeSummary> GetOutcomeSummary();
1313
}
1414
public partial class DCSAReportDataService : IDCSAReportDataService
1515
{
@@ -21,7 +21,7 @@ public DCSAReportDataService(IDbConnection connection, ILogger<SelfAssessmentDat
2121
this.connection = connection;
2222
this.logger = logger;
2323
}
24-
public IEnumerable<DCSAOutcomeSummary> GetOutcomeSummaryForCentre(int centreId)
24+
public IEnumerable<DCSAOutcomeSummary> GetOutcomeSummary()
2525
{
2626
return connection.Query<DCSAOutcomeSummary>(
2727
@"SELECT DATEPART(month, caa.StartedDate) AS EnrolledMonth, DATEPART(yyyy, caa.StartedDate) AS EnrolledYear, jg.JobGroupName AS JobGroup, ca.Answer1 AS CentreField1, ca.Answer2 AS CentreField2, ca.Answer3 AS CentreField3, CASE WHEN (caa.SubmittedDate IS NOT NULL)
@@ -107,24 +107,20 @@ FROM SelfAssessmentResults AS sar INNER JOIN
107107
FROM Candidates AS ca INNER JOIN
108108
CandidateAssessments AS caa ON ca.UserID = caa.DelegateUserID AND ca.CentreID = caa.CentreID INNER JOIN Users AS u ON caa.DelegateUserID = u.ID INNER JOIN
109109
JobGroups AS jg ON u.JobGroupID = jg.JobGroupID
110-
WHERE (ca.Active = 1) AND (ca.CentreID = @centreId) AND (caa.SelfAssessmentID = 1)
111-
ORDER BY EnrolledYear DESC, EnrolledMonth DESC, JobGroup, CentreField1, CentreField2, CentreField3, Status",
112-
new { centreId }
113-
);
110+
WHERE (ca.Active = 1) AND (caa.SelfAssessmentID = 1)
111+
ORDER BY EnrolledYear DESC, EnrolledMonth DESC, JobGroup, CentreField1, CentreField2, CentreField3, Status");
114112
}
115113

116-
public IEnumerable<DCSADelegateCompletionStatus> GetDelegateCompletionStatusForCentre(int centreId)
114+
public IEnumerable<DCSADelegateCompletionStatus> GetDelegateCompletionStatus()
117115
{
118116
return connection.Query<DCSADelegateCompletionStatus>(
119117
@"SELECT DATEPART(month, caa.StartedDate) AS EnrolledMonth, DATEPART(yyyy, caa.StartedDate) AS EnrolledYear, ca.FirstName, ca.LastName, ca.EmailAddress AS Email, ca.Answer1 AS CentreField1, ca.Answer2 AS CentreField2, ca.Answer3 AS CentreField3, CASE WHEN (caa.SubmittedDate IS NOT NULL)
120118
THEN 'Submitted' WHEN (caa.UserBookmark LIKE N'/LearningPortal/SelfAssessment/1/Review' AND caa.SubmittedDate IS NULL) THEN 'Reviewing' ELSE 'Incomplete' END AS Status
121119
FROM Candidates AS ca INNER JOIN
122120
CandidateAssessments AS caa ON ca.UserID = caa.DelegateUserID AND ca.CentreID = caa.CentreID INNER JOIN
123121
JobGroups AS jg ON ca.JobGroupID = jg.JobGroupID
124-
WHERE (ca.Active = 1) AND (ca.CentreID = @centreId) AND caa.NonReportable = 0
125-
ORDER BY EnrolledYear DESC, EnrolledMonth DESC, ca.LastName, ca.FirstName",
126-
new { centreId }
127-
);
122+
WHERE (ca.Active = 1) AND (caa.SelfAssessmentID = 1) AND caa.NonReportable = 0
123+
ORDER BY EnrolledYear DESC, EnrolledMonth DESC, ca.LastName, ca.FirstName");
128124
}
129125
}
130126
}

DigitalLearningSolutions.Data/Models/SelfAssessments/CurrentSelfAssessment.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@ public class CurrentSelfAssessment : SelfAssessment
2323
public int? SupervisorCount { get; set; }
2424
public bool IsSameCentre { get; set; }
2525
public int? DelegateUserId { get; set; }
26+
public string? DelegateName { get; set; }
2627
}
2728
}

DigitalLearningSolutions.Data/Models/Support/RequestAttachment.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public class RequestAttachment
1010
{
1111
public string? Id { get; set; }
1212
public string? FileName { get; set; }
13+
public double? SizeMb { get; set; }
1314
public string? OriginalFileName { get; set; }
1415
public string? FullFileName { get; set; }
1516
public byte[] Content { get; set; }

DigitalLearningSolutions.Web/Controllers/LearningPortalController/SelfAssessment.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,11 +1536,11 @@ public IActionResult SignOffHistory(int selfAssessmentId, string vocabulary)
15361536
};
15371537
return View("SelfAssessments/SignOffHistory", model);
15381538
}
1539-
public IActionResult ExportCandidateAssessment(int candidateAssessmentId, string vocabulary,string candidateAssessmentName)
1539+
public IActionResult ExportCandidateAssessment(int candidateAssessmentId,string candidateAssessmentName, string delegateName)
15401540
{
15411541
var content = candidateAssessmentDownloadFileService.GetCandidateAssessmentDownloadFileForCentre(candidateAssessmentId, User.GetUserIdKnownNotNull(), true);
1542-
var fileName = $"{((candidateAssessmentName.Length > 30) ? candidateAssessmentName.Substring(0, 30) : candidateAssessmentName)} {vocabulary} Assessment Export {clockUtility.UtcNow:yyyy-MM-dd}.xlsx";
1543-
return File(
1542+
var fileName = $"{((candidateAssessmentName.Length > 30) ? candidateAssessmentName.Substring(0, 30) : candidateAssessmentName)} - {delegateName} - {clockUtility.UtcNow:yyyy-MM-dd}.xlsx";
1543+
return File(
15441544
content,
15451545
FileHelper.GetContentTypeFromFileName(fileName),
15461546
fileName

DigitalLearningSolutions.Web/Controllers/Support/RequestSupportTicketController.cs

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,10 @@ public IActionResult SetAttachment(DlsSubApplication dlsSubApplication, RequestA
170170
MultiPageFormDataFeature.AddCustomWebForm("RequestSupportTicketCWF"),
171171
TempData
172172
).GetAwaiter().GetResult(); ;
173-
173+
requestAttachmentmodel.RequestAttachment = data.RequestAttachment;
174174
if (requestAttachmentmodel.ImageFiles == null)
175175
{
176-
requestAttachmentmodel.RequestAttachment = data.RequestAttachment;
176+
//requestAttachmentmodel.RequestAttachment = data.RequestAttachment;
177177
ModelState.AddModelError("ImageFiles", "Please select at least one image");
178178
return View("RequestAttachment", requestAttachmentmodel);
179179
}
@@ -184,13 +184,13 @@ public IActionResult SetAttachment(DlsSubApplication dlsSubApplication, RequestA
184184
(bool? fileExtension, bool? fileSize) = validateUploadedImages(requestAttachmentmodel);
185185
if (fileExtension == true)
186186
{
187-
requestAttachmentmodel.RequestAttachment = data.RequestAttachment;
187+
//requestAttachmentmodel.RequestAttachment = data.RequestAttachment;
188188
ModelState.AddModelError("FileExtensionError", "File must be in valid image formats jpg, jpeg, png, bmp or mp4 video format");
189189
return View("RequestAttachment", requestAttachmentmodel);
190190
}
191191
if (fileSize == true)
192192
{
193-
requestAttachmentmodel.RequestAttachment = data.RequestAttachment;
193+
//requestAttachmentmodel.RequestAttachment = data.RequestAttachment;
194194
ModelState.AddModelError("FileSizeError", "Maximum allowed file size is 20MB");
195195
return View("RequestAttachment", requestAttachmentmodel);
196196
}
@@ -202,7 +202,8 @@ public IActionResult SetAttachment(DlsSubApplication dlsSubApplication, RequestA
202202
{
203203
OriginalFileName = item.FileName,
204204
FileName = fileName,
205-
FullFileName = uploadDir + fileName
205+
FullFileName = uploadDir + fileName,
206+
SizeMb = Convert.ToDouble(item.Length.ToSize(FileSizeCalc.SizeUnits.MB))
206207
};
207208
RequestAttachmentList.Add(RequestAttachment);
208209
}
@@ -370,6 +371,13 @@ private string UploadFile(IFormFile file)
370371
private (bool, bool) validateUploadedImages(RequestAttachmentViewModel requestAttachmentmodel)
371372
{
372373
var totalFileSize = 0.00;
374+
if (requestAttachmentmodel.RequestAttachment != null)
375+
{
376+
foreach (var item in requestAttachmentmodel.RequestAttachment)
377+
{
378+
totalFileSize = totalFileSize + item.SizeMb??0;
379+
}
380+
}
373381
foreach (var item in requestAttachmentmodel.ImageFiles)
374382
{
375383
var extension = Path.GetExtension(item.FileName);
@@ -380,10 +388,11 @@ private string UploadFile(IFormFile file)
380388
}
381389
var fileSize = Convert.ToDouble(item.Length.ToSize(FileSizeCalc.SizeUnits.MB));
382390
totalFileSize = totalFileSize + fileSize;
383-
if (fileSize > requestAttachmentmodel.SizeLimit || totalFileSize > requestAttachmentmodel.SizeLimit)
384-
{
385-
requestAttachmentmodel.FileSizeFlag = true;
386-
}
391+
392+
}
393+
if (totalFileSize > requestAttachmentmodel.SizeLimit)
394+
{
395+
requestAttachmentmodel.FileSizeFlag = true;
387396
}
388397
return (requestAttachmentmodel.FileExtensionFlag ?? false, requestAttachmentmodel.FileSizeFlag ?? false);
389398
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public IActionResult Index()
4242
public IActionResult DownloadDigitalCapabilityToExcel()
4343
{
4444
var centreId = User.GetCentreIdKnownNotNull();
45-
var dataFile = selfAssessmentReportService.GetDigitalCapabilityExcelExportForCentre(centreId);
46-
var fileName = $"DLS DSAT Report - Centre {centreId} - downloaded {clockUtility.UtcToday:yyyy-MM-dd}.xlsx";
45+
var dataFile = selfAssessmentReportService.GetDigitalCapabilityExcelExport();
46+
var fileName = $"DLS DSAT Report - downloaded {clockUtility.UtcToday:yyyy-MM-dd}.xlsx";
4747
return File(
4848
dataFile,
4949
FileHelper.GetContentTypeFromFileName(fileName),

DigitalLearningSolutions.Web/Services/SelfAssessmentReportService.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
public interface ISelfAssessmentReportService
1313
{
14-
byte[] GetDigitalCapabilityExcelExportForCentre(int centreId);
14+
byte[] GetDigitalCapabilityExcelExport();
1515
byte[] GetSelfAssessmentExcelExportForCentre(int centreId, int selfAssessmentId);
1616
IEnumerable<SelfAssessmentSelect> GetSelfAssessmentsForReportList(int centreId, int? categoryId);
1717
}
@@ -34,10 +34,10 @@ private static void AddSheetToWorkbook(IXLWorkbook workbook, string sheetName, I
3434
table.Theme = XLTableTheme.TableStyleLight9;
3535
sheet.Columns().AdjustToContents();
3636
}
37-
public byte[] GetDigitalCapabilityExcelExportForCentre(int centreId)
37+
public byte[] GetDigitalCapabilityExcelExport()
3838
{
39-
var delegateCompletionStatus = dcsaReportDataService.GetDelegateCompletionStatusForCentre(centreId);
40-
var outcomeSummary = dcsaReportDataService.GetOutcomeSummaryForCentre(centreId);
39+
var delegateCompletionStatus = dcsaReportDataService.GetDelegateCompletionStatus();
40+
var outcomeSummary = dcsaReportDataService.GetOutcomeSummary();
4141
var summary = delegateCompletionStatus.Select(
4242
x => new
4343
{

DigitalLearningSolutions.Web/Views/LearningPortal/SelfAssessments/_OverviewActionButtons.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<a class="nhsuk-button nhsuk-button--secondary"
2525
asp-route-candidateAssessmentId="@Model.SelfAssessment.CandidateAssessmentId"
2626
asp-route-candidateAssessmentName="@Model.SelfAssessment.Name"
27-
asp-route-vocabulary="@Model.VocabPlural()"
27+
asp-route-delegateName="@Model.SelfAssessment.DelegateName"
2828
asp-action="ExportCandidateAssessment"
2929
role="button">
3030
Export to Excel

DigitalLearningSolutions.Web/Views/Support/RequestSupportTicket/RequestAttachment.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
</legend>
3535
<div class="nhsuk-form-group">
3636
<label class="nhsuk-label" for="ImageFiles">
37-
If you have any screenshots that help illustrate your request, attach them here. The maximum total file size for uploaded files is 20MB.
37+
If you have any screenshots that help illustrate your request, attach them here. The maximum total file size for uploaded files is 20 MB.
3838
</label>
3939
@if (!ViewData.ModelState.IsValid)
4040
{
@@ -60,7 +60,7 @@
6060
<div class="nhsuk-summary-list__row">
6161

6262
<dd class="nhsuk-summary-list__value">
63-
@a.OriginalFileName
63+
@a.OriginalFileName (@a.SizeMb.ToString() MB)
6464
</dd>
6565
<dd class="nhsuk-summary-list__actions">
6666
<a asp-action="DeleteImage" asp-all-route-data="@cancelLinkData" asp-route-imageName="@a.FileName" asp-route-imageId="@a.Id">

0 commit comments

Comments
 (0)