@@ -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