From 654f926548029d6a062f4760b1845139ba21066b Mon Sep 17 00:00:00 2001 From: Michael Linares Date: Mon, 27 Nov 2023 09:51:33 +0100 Subject: [PATCH] Added implementation of feature flag. --- .../lesson/service/lesson-copy.service.ts | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/apps/server/src/modules/lesson/service/lesson-copy.service.ts b/apps/server/src/modules/lesson/service/lesson-copy.service.ts index 7c2247fb72d..9f2caef7b03 100644 --- a/apps/server/src/modules/lesson/service/lesson-copy.service.ts +++ b/apps/server/src/modules/lesson/service/lesson-copy.service.ts @@ -225,17 +225,25 @@ export class LessonCopyService { copiedContentStatus.push(embeddedTaskStatus); } if (element.component === ComponentType.NEXBOARD && nexboardEnabled) { - // eslint-disable-next-line no-await-in-loop - const nexboardContent = await this.copyNexboard(element, params); - const nexboardStatus = { + let nexboardStatus = { title: element.title, type: CopyElementType.LESSON_CONTENT_NEXBOARD, status: CopyStatusEnum.PARTIAL, }; - if (nexboardContent) { - copiedContent.push(nexboardContent); - } else { - nexboardStatus.status = CopyStatusEnum.FAIL; + if (!copyNexboardEnabled) { + nexboardStatus.status = CopyStatusEnum.NOT_DOING; + } + if (nexboardStatus.status === CopyStatusEnum.PARTIAL) { + try { + const nexboardContent = await this.copyNexboard(element, params); + if (nexboardContent) { + copiedContent.push(nexboardContent); + } else { + nexboardStatus.status = CopyStatusEnum.NOT_DOING; + } + } catch (error) { + nexboardStatus.status = CopyStatusEnum.NOT_DOING; + } } copiedContentStatus.push(nexboardStatus); }