File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6178,7 +6178,9 @@ export class PostgresCohortMembersService {
61786178 const tenantId = process . env . DEFAULT_TENANT_ID ;
61796179 const organisationId = process . env . DEFAULT_ORGANISATION_ID ;
61806180
6181- const courseIds = courses . map ( ( c ) => c . courseId ) ;
6181+ const courseIds = courses
6182+ . map ( ( c ) => c . courseId || c . id || c . course_id )
6183+ . filter ( ( id ) => ! ! id ) ;
61826184
61836185 try {
61846186 const requestUrl = `${ lmsBaseUrl } /lms-service/v1/enrollments` ;
@@ -6319,22 +6321,25 @@ export class PostgresCohortMembersService {
63196321 // Use for...of loop for proper async handling
63206322 for ( let i = 0 ; i < courses . length ; i ++ ) {
63216323 const course = courses [ i ] ;
6324+ const courseId = course . courseId || course . id || course . course_id ;
6325+
6326+ if ( ! courseId ) continue ;
63226327
63236328 try {
63246329 const deenrollmentResult = await this . deenrollUserFromSingleCourse (
63256330 userId ,
6326- course . courseId ,
6331+ courseId ,
63276332 cohortId
63286333 ) ;
63296334
63306335 deenrollmentResults . push ( {
6331- courseId : course . courseId ,
6336+ courseId : courseId ,
63326337 status : 'success' ,
63336338 result : deenrollmentResult ,
63346339 } ) ;
63356340 } catch ( error ) {
63366341 deenrollmentResults . push ( {
6337- courseId : course . courseId ,
6342+ courseId : courseId ,
63386343 status : 'error' ,
63396344 error : error . message ,
63406345 } ) ;
You can’t perform that action at this time.
0 commit comments