Skip to content

Commit b77a974

Browse files
authored
Merge pull request #2076 from TechnologyEnhancedLearning/Develop/Fixes/TD-1877_Allow_supervisor_to_export_a_summary_of_a_learner_progress_to_Excel
TD-1877 Allowed supervisor to export a summary of a learner's progres…
2 parents 51d9b6d + 8143095 commit b77a974

File tree

6 files changed

+42
-5
lines changed

6 files changed

+42
-5
lines changed

DigitalLearningSolutions.Data/DataServices/SupervisorService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ FROM CandidateAssessmentSupervisorVerifications AS casv
554554
(SELECT COUNT(*) AS Expr1
555555
FROM SelfAssessmentResultSupervisorVerifications AS sarsv
556556
WHERE (CandidateAssessmentSupervisorID = cas.ID) AND (Verified IS NULL) AND (Superceded = 0)) AS ResultsVerificationRequests,
557-
ca.NonReportable
557+
ca.NonReportable,ca.DelegateUserID
558558
FROM CandidateAssessmentSupervisors AS cas INNER JOIN
559559
CandidateAssessments AS ca ON cas.CandidateAssessmentID = ca.ID INNER JOIN
560560
SelfAssessments AS sa ON sa.ID = ca.SelfAssessmentID INNER JOIN

DigitalLearningSolutions.Web/Controllers/SupervisorController/Supervisor.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,8 @@ public IActionResult ReviewDelegateSelfAssessment(int supervisorDelegateId, int
347347
CompetencyGroups = competencies.GroupBy(competency => competency.CompetencyGroup),
348348
IsSupervisorResultsReviewed = delegateSelfAssessment.IsSupervisorResultsReviewed,
349349
SearchViewModel = searchModel,
350+
CandidateAssessmentId = candidateAssessmentId,
351+
ExportToExcelHide = delegateSelfAssessment.SupervisorRoleTitle.Contains("Assessor")
350352
};
351353

352354
var flags = frameworkService.GetSelectedCompetencyFlagsByCompetecyIds(reviewedCompetencies.Select(c => c.Id).ToArray());
@@ -1299,9 +1301,19 @@ private int IsSupervisorDelegateExistAndActive(int adminId, string delegateEmail
12991301
{
13001302
return 0;
13011303
}
1302-
13031304
}
13041305
return existingId;
13051306
}
1307+
1308+
public IActionResult ExportCandidateAssessment(int candidateAssessmentId, string delegateName, string selfAssessmentName,int delegateUserID)
1309+
{
1310+
var content = candidateAssessmentDownloadFileService.GetCandidateAssessmentDownloadFileForCentre(candidateAssessmentId, delegateUserID, true);
1311+
var fileName = $"{selfAssessmentName.Substring(0,29)}-{delegateName}-{clockUtility.UtcNow:yyyy-MM-dd}.xlsx";
1312+
return File(
1313+
content,
1314+
FileHelper.GetContentTypeFromFileName(fileName),
1315+
fileName
1316+
);
1317+
}
13061318
}
13071319
}

DigitalLearningSolutions.Web/Controllers/SupervisorController/SupervisorController.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
{
33
using DigitalLearningSolutions.Data.DataServices;
44
using DigitalLearningSolutions.Data.DataServices.UserDataService;
5+
using DigitalLearningSolutions.Data.Services;
6+
using DigitalLearningSolutions.Data.Utilities;
57
using DigitalLearningSolutions.Web.Helpers;
68
using DigitalLearningSolutions.Web.Services;
79
using GDS.MultiPageFormData;
@@ -26,6 +28,8 @@ public partial class SupervisorController : Controller
2628
private readonly IUserService userService;
2729
private readonly IEmailGenerationService emailGenerationService;
2830
private readonly IEmailService emailService;
31+
private readonly ICandidateAssessmentDownloadFileService candidateAssessmentDownloadFileService;
32+
private readonly IClockUtility clockUtility;
2933

3034
public SupervisorController(
3135
ISupervisorService supervisorService,
@@ -43,9 +47,11 @@ public SupervisorController(
4347
IRegistrationService registrationService,
4448
ICentresDataService centresDataService,
4549
IUserService userService,
46-
IEmailGenerationService emailGenerationService,
47-
IEmailService emailService
48-
)
50+
IEmailGenerationService emailGenerationService,
51+
IEmailService emailService,
52+
ICandidateAssessmentDownloadFileService candidateAssessmentDownloadFileService,
53+
IClockUtility clockUtility
54+
)
4955
{
5056
this.supervisorService = supervisorService;
5157
this.frameworkNotificationService = frameworkNotificationService;
@@ -60,6 +66,8 @@ IEmailService emailService
6066
this.userService = userService;
6167
this.emailGenerationService = emailGenerationService;
6268
this.emailService = emailService;
69+
this.candidateAssessmentDownloadFileService = candidateAssessmentDownloadFileService;
70+
this.clockUtility = clockUtility;
6371
}
6472

6573
private int GetCentreId()

DigitalLearningSolutions.Web/Styles/frameworks/frameworksShared.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,3 +248,6 @@ h1.truncate-overflow::after {
248248
inline-size: 305px;
249249
}
250250
}
251+
.float-right{
252+
float:right;
253+
}

DigitalLearningSolutions.Web/ViewModels/Supervisor/ReviewSelfAssessmentViewModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,7 @@ public string VocabPlural(string vocabulary)
1919
{
2020
return FrameworkVocabularyHelper.VocabularyPlural(vocabulary);
2121
}
22+
public int CandidateAssessmentId { get; set; }
23+
public bool ExportToExcelHide { get; set; }
2224
}
2325
}

DigitalLearningSolutions.Web/Views/Supervisor/ReviewSelfAssessment.cshtml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,18 @@
8282
</div>
8383
</div>
8484
<div class="nhsuk-grid-column-one-third">
85+
@if (!Model.ExportToExcelHide)
86+
{
87+
<a class="nhsuk-button nhsuk-button--secondary float-right"
88+
asp-route-candidateAssessmentId="@Model.CandidateAssessmentId"
89+
asp-route-selfAssessmentName="@Model.DelegateSelfAssessment.RoleName"
90+
asp-route-delegateUserID="@Model.DelegateSelfAssessment.DelegateUserID"
91+
asp-route-delegateName="@Model.SupervisorDelegateDetail.FirstName @Model.SupervisorDelegateDetail.LastName"
92+
asp-action="ExportCandidateAssessment"
93+
role="button">
94+
Export to Excel
95+
</a>
96+
}
8597
@if (Model.DelegateSelfAssessment.SignOffRequested > 0)
8698
{
8799
<a role="button" asp-action="SignOffProfileAssessment" asp-route-candidateAssessmentId="@Model.DelegateSelfAssessment.ID" asp-route-supervisorDelegateId="@Model.SupervisorDelegateDetail.ID" class="nhsuk-button">Sign-off self assessment</a>

0 commit comments

Comments
 (0)