Skip to content

Commit 4d82530

Browse files
committed
Merge branch 'Release-2023.26-Hotfix' into UAT
2 parents d69095f + 4683a85 commit 4d82530

File tree

5 files changed

+91
-88
lines changed

5 files changed

+91
-88
lines changed

DigitalLearningSolutions.Data/DataServices/CourseContentService.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,19 +269,19 @@ FROM Sessions AS S1 WITH (NOLOCK)
269269
{
270270
try
271271
{
272-
return connection.QueryFirst<int>(
273-
@"SELECT ProgressId
274-
FROM Progress
272+
return connection.QueryFirst<int?>(
273+
@"SELECT COALESCE((SELECT ProgressID
274+
FROM Progress
275275
WHERE CandidateID = @candidateId
276276
AND CustomisationID = @customisationId
277277
AND SystemRefreshed = 0
278-
AND RemovedDate IS NULL",
278+
AND RemovedDate IS NULL), NULL) AS ProgressId",
279279
new { candidateId, customisationId }
280280
);
281281
}
282282
catch (InvalidOperationException)
283283
{
284-
return null;
284+
return 0;
285285
}
286286
}
287287
}

DigitalLearningSolutions.Web.Tests/Controllers/LearningMenu/IndexTests.cs

Lines changed: 44 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -241,49 +241,50 @@ public void Index_unable_to_enrol_should_not_StartOrUpdate_course_sessions()
241241
// Then
242242
A.CallTo(() => sessionService.StartOrUpdateDelegateSession(A<int>._, A<int>._, A<ISession>._)).MustNotHaveHappened();
243243
}
244-
245-
[Test]
246-
public void Index_detects_id_manipulation_no_progress_id()
247-
{
248-
// Given
249-
var expectedCourseContent = CourseContentHelper.CreateDefaultCourseContent(CustomisationId);
250-
A.CallTo(() => courseContentService.GetCourseContent(CandidateId, CustomisationId))
251-
.Returns(expectedCourseContent);
252-
A.CallTo(() => courseContentService.GetOrCreateProgressId(CandidateId, CustomisationId, CentreId)).Returns(10);
253-
A.CallTo(() => courseContentService.GetProgressId(CandidateId, CustomisationId)).Returns(null);
254-
255-
// When
256-
var result = controller.Index(CustomisationId);
257-
258-
// Then
259-
result.Should()
260-
.BeRedirectToActionResult()
261-
.WithControllerName("LearningSolutions")
262-
.WithActionName("StatusCode")
263-
.WithRouteValue("code", 404);
264-
}
265-
266-
[Test]
267-
public void Index_detects_id_manipulation_self_register_false()
268-
{
269-
// Given
270-
var expectedCourseContent = CourseContentHelper.CreateDefaultCourseContent(CustomisationId);
271-
A.CallTo(() => courseContentService.GetCourseContent(CandidateId, CustomisationId))
272-
.Returns(expectedCourseContent);
273-
A.CallTo(() => courseContentService.GetOrCreateProgressId(CandidateId, CustomisationId, CentreId)).Returns(10);
274-
A.CallTo(() => courseContentService.GetProgressId(CandidateId, CustomisationId)).Returns(null);
275-
A.CallTo(() => courseDataService.GetSelfRegister(CustomisationId)).Returns(false);
276-
277-
// When
278-
var result = controller.Index(CustomisationId);
279-
280-
// Then
281-
result.Should()
282-
.BeRedirectToActionResult()
283-
.WithControllerName("LearningSolutions")
284-
.WithActionName("StatusCode")
285-
.WithRouteValue("code", 404);
286-
}
244+
//Deprecated in response to TD-3838 - a bug caused by this id manipulation detection functionality
245+
246+
//[Test]
247+
//public void Index_detects_id_manipulation_no_progress_id()
248+
//{
249+
// // Given
250+
// var expectedCourseContent = CourseContentHelper.CreateDefaultCourseContent(CustomisationId);
251+
// A.CallTo(() => courseContentService.GetCourseContent(CandidateId, CustomisationId))
252+
// .Returns(expectedCourseContent);
253+
// A.CallTo(() => courseContentService.GetOrCreateProgressId(CandidateId, CustomisationId, CentreId)).Returns(10);
254+
// A.CallTo(() => courseContentService.GetProgressId(CandidateId, CustomisationId)).Returns(null);
255+
256+
// // When
257+
// var result = controller.Index(CustomisationId);
258+
259+
// // Then
260+
// result.Should()
261+
// .BeRedirectToActionResult()
262+
// .WithControllerName("LearningSolutions")
263+
// .WithActionName("StatusCode")
264+
// .WithRouteValue("code", 404);
265+
//}
266+
267+
//[Test]
268+
//public void Index_detects_id_manipulation_self_register_false()
269+
//{
270+
// // Given
271+
// var expectedCourseContent = CourseContentHelper.CreateDefaultCourseContent(CustomisationId);
272+
// A.CallTo(() => courseContentService.GetCourseContent(CandidateId, CustomisationId))
273+
// .Returns(expectedCourseContent);
274+
// A.CallTo(() => courseContentService.GetOrCreateProgressId(CandidateId, CustomisationId, CentreId)).Returns(10);
275+
// A.CallTo(() => courseContentService.GetProgressId(CandidateId, CustomisationId)).Returns(null);
276+
// A.CallTo(() => courseDataService.GetSelfRegister(CustomisationId)).Returns(false);
277+
278+
// // When
279+
// var result = controller.Index(CustomisationId);
280+
281+
// // Then
282+
// result.Should()
283+
// .BeRedirectToActionResult()
284+
// .WithControllerName("LearningSolutions")
285+
// .WithActionName("StatusCode")
286+
// .WithRouteValue("code", 404);
287+
//}
287288

288289
[Test]
289290
public void Index_not_detects_id_manipulation_self_register_true()

DigitalLearningSolutions.Web/Controllers/LearningMenuController/LearningMenuController.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,11 @@ public IActionResult Index(int customisationId)
8585
var sectionId = courseContent.Sections.First().Id;
8686
return RedirectToAction("Section", "LearningMenu", new { customisationId, sectionId });
8787
}
88-
if (UniqueIdManipulationDetected(candidateId, customisationId))
89-
{
90-
return RedirectToAction("StatusCode", "LearningSolutions", new { code = 404 });
91-
}
88+
// Unique Id Manipulation Detection is being disabled as part of work on TD-3838 - a bug created by its introduction
89+
//if (UniqueIdManipulationDetected(candidateId, customisationId))
90+
//{
91+
// return RedirectToAction("StatusCode", "LearningSolutions", new { code = 404 });
92+
//}
9293
var progressId = courseContentService.GetOrCreateProgressId(candidateId, customisationId, centreId);
9394
if (progressId == null)
9495
{
@@ -97,6 +98,7 @@ public IActionResult Index(int customisationId)
9798
$"Candidate id: {candidateId}, customisation id: {customisationId}, centre id: {centreId}");
9899
return RedirectToAction("StatusCode", "LearningSolutions", new { code = 404 });
99100
}
101+
100102
if (sessionService.StartOrUpdateDelegateSession(candidateId, customisationId, HttpContext.Session) > 0)
101103
{
102104
courseContentService.UpdateProgress(progressId.Value);

DigitalLearningSolutions.Web/Views/LearningPortal/Current/CompetencySelfAssessmentCertificate.cshtml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -137,26 +137,26 @@
137137
</div>
138138

139139
<div class="body">
140-
<h3 class=" nhsuk-u-margin-bottom-3">
141-
Including the following optional proficiencies:
142-
</h3>
143-
@foreach (var entry in Model.CompetencyCountSelfAssessmentCertificate)
140+
@if (Model.CompetencyCountSelfAssessmentCertificate.Any())
144141
{
145-
<p class="nhsuk-u-margin-bottom-2 nhsuk-body-s">
146-
@entry.CompetencyGroup - @entry.OptionalCompetencyCount
147-
@if (@entry.OptionalCompetencyCount == 1)
148-
{
149-
@Model.CompetencySelfAssessmentCertificates.Vocabulary
150-
}
151-
else
152-
{
153-
@Model.VocabPlural
154-
}
155-
156-
</p>
157-
142+
<h3 class=" nhsuk-u-margin-bottom-3">
143+
Including the following optional proficiencies:
144+
</h3>
145+
@foreach (var entry in Model.CompetencyCountSelfAssessmentCertificate)
146+
{
147+
<p class="nhsuk-u-margin-bottom-2 nhsuk-body-s">
148+
@entry.CompetencyGroup - @entry.OptionalCompetencyCount
149+
@if (@entry.OptionalCompetencyCount == 1)
150+
{
151+
@Model.CompetencySelfAssessmentCertificates.Vocabulary
152+
}
153+
else
154+
{
155+
@Model.VocabPlural
156+
}
157+
</p>
158+
}
158159
}
159-
160160
</div>
161161

162162
<div class="footer">

DigitalLearningSolutions.Web/Views/LearningPortal/Current/DownloadCompetencySelfAssessmentCertificate.cshtml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -446,26 +446,26 @@
446446
</div>
447447

448448
<div class="body">
449-
<h3 class=" nhsuk-u-margin-bottom-3">
450-
Including the following optional proficiencies:
451-
</h3>
452-
@foreach (var entry in Model.CompetencyCountSelfAssessmentCertificate)
449+
@if (Model.CompetencyCountSelfAssessmentCertificate.Any())
453450
{
454-
<p class="nhsuk-u-margin-bottom-2 nhsuk-body-s">
455-
@entry.CompetencyGroup - @entry.OptionalCompetencyCount
456-
@if (@entry.OptionalCompetencyCount == 1)
457-
{
458-
@Model.CompetencySelfAssessmentCertificates.Vocabulary
459-
}
460-
else
461-
{
462-
@Model.VocabPlural
463-
}
464-
465-
</p>
466-
451+
<h3 class=" nhsuk-u-margin-bottom-3">
452+
Including the following optional proficiencies:
453+
</h3>
454+
@foreach (var entry in Model.CompetencyCountSelfAssessmentCertificate)
455+
{
456+
<p class="nhsuk-u-margin-bottom-2 nhsuk-body-s">
457+
@entry.CompetencyGroup - @entry.OptionalCompetencyCount
458+
@if (@entry.OptionalCompetencyCount == 1)
459+
{
460+
@Model.CompetencySelfAssessmentCertificates.Vocabulary
461+
}
462+
else
463+
{
464+
@Model.VocabPlural
465+
}
466+
</p>
467+
}
467468
}
468-
469469
</div>
470470

471471
<div class="footer">

0 commit comments

Comments
 (0)