Skip to content

Commit fc760ef

Browse files
TD-5291 Issue on 'Course set up' screen when selected Few course content first time and changed to 'All' of them clicking 'change link'
1 parent 4c1d42f commit fc760ef

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

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

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -744,18 +744,19 @@ private static IEnumerable<CourseStatisticsWithAdminFieldResponseCounts> UpdateC
744744
private IEnumerable<Tutorial> GetTutorialsFromSectionContentData(List<SectionContentTempData> sectionContentData, List<Tutorial> sectionTutorial)
745745
{
746746
if (sectionContentData == null || sectionTutorial == null) return new List<Tutorial>();
747-
var updatedRecords = sectionContentData
748-
.SelectMany(data => data.Tutorials)
749-
.Join(sectionTutorial,
750-
tempData => new { tempData.TutorialId, tempData.TutorialName }, // Match on both TutorialId and TutorialName
751-
index => new { index.TutorialId, index.TutorialName },
752-
(tempData, index) => new Tutorial
747+
var updatedRecords = sectionTutorial
748+
.GroupJoin(
749+
sectionContentData.SelectMany(data => data.Tutorials),
750+
tutorial => new { tutorial.TutorialId, tutorial.TutorialName },
751+
tempData => new { tempData.TutorialId, tempData.TutorialName },
752+
(tutorial, matchingTempData) => new Tutorial
753753
{
754-
TutorialId = index.TutorialId,
755-
TutorialName = index.TutorialName,
756-
Status = tempData.LearningEnabled, // Updated from sectionContentData
757-
DiagStatus = tempData.DiagnosticEnabled // Updated from sectionContentData
758-
})
754+
TutorialId = tutorial.TutorialId,
755+
TutorialName = tutorial.TutorialName,
756+
Status = matchingTempData.Any() ? matchingTempData.First().LearningEnabled : tutorial.Status,
757+
DiagStatus = matchingTempData.Any() ? matchingTempData.First().DiagnosticEnabled : tutorial.DiagStatus
758+
}
759+
)
759760
.ToList();
760761

761762
return updatedRecords;

0 commit comments

Comments
 (0)