Skip to content

Commit 05a4579

Browse files
committed
Merge branch 'DLS-Release-v1.1.1' into UAT
2 parents 58c3540 + d363e89 commit 05a4579

File tree

5 files changed

+22
-20
lines changed

5 files changed

+22
-20
lines changed

DigitalLearningSolutions.Data/DataServices/CourseDataService.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -537,16 +537,16 @@ LEFT OUTER JOIN UserCentreDetails AS UCD ON
537537
if (candidateAssessmentId > 1 && supervisorDelegateId == 0)
538538
{
539539
connection.Execute(
540-
@"UPDATE CandidateAssessments SET RemovedDate = NULL, EnrolmentMethodId = @enrolmentMethodId, CompleteByDate = @completeByDateDynamic
540+
@"UPDATE CandidateAssessments SET RemovedDate = NULL, EnrolmentMethodId = @enrolmentMethodId, CompleteByDate = @completeByDateDynamic, EnrolledByAdminId = @enrolledByAdminId
541541
WHERE ID = @candidateAssessmentId",
542-
new { candidateAssessmentId, enrolmentMethodId, completeByDateDynamic }
542+
new { candidateAssessmentId, enrolmentMethodId, completeByDateDynamic, enrolledByAdminId }
543543
);
544544
}
545545
if (candidateAssessmentId > 1 && supervisorDelegateId != 0)
546546
{
547547
string sqlQuery = $@"
548548
BEGIN TRANSACTION
549-
UPDATE CandidateAssessments SET RemovedDate = NULL, EnrolmentMethodId = @enrolmentMethodId, CompleteByDate = @completeByDateDynamic
549+
UPDATE CandidateAssessments SET RemovedDate = NULL, EnrolmentMethodId = @enrolmentMethodId, CompleteByDate = @completeByDateDynamic, EnrolledByAdminId = @enrolledByAdminId
550550
WHERE ID = @candidateAssessmentId
551551
552552
UPDATE CandidateAssessmentSupervisors SET Removed = NULL
@@ -556,7 +556,7 @@ BEGIN TRANSACTION
556556
COMMIT TRANSACTION";
557557

558558
connection.Execute(sqlQuery
559-
, new { candidateAssessmentId, selfAssessmentSupervisorRoleId, enrolmentMethodId, completeByDateDynamic, supervisorDelegateId });
559+
, new { candidateAssessmentId, selfAssessmentSupervisorRoleId, enrolmentMethodId, completeByDateDynamic, supervisorDelegateId, enrolledByAdminId });
560560
}
561561

562562
if (supervisorId > 0)

DigitalLearningSolutions.Data/Models/MultiPageFormData/AddNewCentreCourse/AddNewCentreCourseTempData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public AddNewCentreCourseTempData()
1717
public CourseOptionsTempData? CourseOptionsData { get; set; }
1818
public CourseContentTempData? CourseContentData { get; set; }
1919
public List<SectionContentTempData>? SectionContentData { get; set; }
20-
20+
public bool EditCourseContent { get; set; }
2121
public void SetApplicationAndResetModels(ApplicationDetails application)
2222
{
2323
if (Application == application)

DigitalLearningSolutions.Web.Tests/Controllers/TrackingSystem/CourseSetup/CourseSetupControllerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ public void SetCourseContent_get_redirects_to_summary_if_application_has_no_sect
416416
).Returns(new List<Section>());
417417

418418
// When
419-
var result = controller.SetCourseContent();
419+
var result = controller.SetCourseContent(false);
420420

421421
// Then
422422
result.Should().BeRedirectToActionResult().WithActionName("Summary");

DigitalLearningSolutions.Web/Controllers/TrackingSystem/CourseSetup/CourseSetupController.cs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -365,22 +365,24 @@ public IActionResult SetCourseOptions(EditCourseOptionsFormData model)
365365
data!.CourseOptionsData = model.ToCourseOptionsTempData();
366366
multiPageFormService.SetMultiPageFormData(data, MultiPageFormDataFeature.AddNewCourse, TempData);
367367

368-
return RedirectToAction("SetCourseContent");
368+
return RedirectToAction("SetCourseContent", false);
369369
}
370370

371371
[HttpGet("AddCourse/SetCourseContent")]
372372
[TypeFilter(
373373
typeof(RedirectMissingMultiPageFormData),
374374
Arguments = new object[] { nameof(MultiPageFormDataFeature.AddNewCourse) }
375375
)]
376-
public IActionResult SetCourseContent()
376+
public IActionResult SetCourseContent(bool editCourseContent)
377377
{
378378
var data = multiPageFormService.GetMultiPageFormData<AddNewCentreCourseTempData>(MultiPageFormDataFeature.AddNewCourse, TempData).GetAwaiter().GetResult();
379379

380380
if (!sectionService.GetSectionsThatHaveTutorialsForApplication(data!.Application!.ApplicationId).Any())
381381
{
382382
return RedirectToAction("Summary");
383383
}
384+
data.EditCourseContent = editCourseContent;
385+
multiPageFormService.SetMultiPageFormData(data, MultiPageFormDataFeature.AddNewCourse, TempData);
384386

385387
var model = data!.CourseContentData != null
386388
? new SetCourseContentViewModel(data.CourseContentData)
@@ -457,7 +459,7 @@ public IActionResult SetSectionContent(int sectionIndex)
457459
}
458460

459461
var showDiagnostic = data.Application!.DiagAssess;
460-
if (data.SectionContentData != null && data.SectionContentData.Count >=3 )
462+
if (data.EditCourseContent)
461463
{
462464
var tutorial = GetTutorialsFromSectionContentData(data.SectionContentData, tutorials);
463465
var model = new SetSectionContentViewModel(section, sectionIndex, showDiagnostic, tutorial);
@@ -649,20 +651,19 @@ private IActionResult SaveSectionAndRedirect(SetSectionContentViewModel model)
649651
{
650652
data.SectionContentData = new List<SectionContentTempData>();
651653
}
652-
if (data.SectionContentData != null && data.SectionContentData.Count >= 3)
654+
if (data.EditCourseContent)
653655
{
654656
return RedirectToNextSectionOrSummary(
655657
model.Index,
656-
new SetCourseContentViewModel(data.CourseContentData!)
657-
);
658+
new SetCourseContentViewModel(data.CourseContentData!));
658659
}
659-
data!.SectionContentData!.Add(
660-
new SectionContentTempData(
661-
model.Tutorials != null
662-
? model.Tutorials.Select(GetCourseTutorialData)
663-
: new List<CourseTutorialTempData>()
664-
)
665-
);
660+
data!.SectionContentData!.Add(
661+
new SectionContentTempData(
662+
model.Tutorials != null
663+
? model.Tutorials.Select(GetCourseTutorialData)
664+
: new List<CourseTutorialTempData>()
665+
)
666+
);
666667
multiPageFormService.SetMultiPageFormData(data, MultiPageFormDataFeature.AddNewCourse, TempData);
667668

668669
return RedirectToNextSectionOrSummary(

DigitalLearningSolutions.Web/Views/TrackingSystem/CourseSetup/AddNewCentreCourse/_CourseContentSummary.cshtml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
<dd class="nhsuk-summary-list__actions">
2727
@if (!Model.NoContent)
2828
{
29-
<a asp-action="SetCourseContent">
29+
<a asp-action="SetCourseContent"
30+
asp-route-EditCourseContent="true">
3031
Change<span class="nhsuk-u-visually-hidden"> course content</span>
3132
</a>
3233
}

0 commit comments

Comments
 (0)