From 4b0caec758d0b300c6659a22407bf09ccf50d812 Mon Sep 17 00:00:00 2001 From: Firas Shmit Date: Tue, 28 Nov 2023 11:45:55 +0100 Subject: [PATCH 1/2] EW-359 implemented export of tasks from topics --- .../learnroom/service/common-cartridge-export.service.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/server/src/modules/learnroom/service/common-cartridge-export.service.ts b/apps/server/src/modules/learnroom/service/common-cartridge-export.service.ts index 4da9bfeedd0..1ba81d7e221 100644 --- a/apps/server/src/modules/learnroom/service/common-cartridge-export.service.ts +++ b/apps/server/src/modules/learnroom/service/common-cartridge-export.service.ts @@ -59,6 +59,11 @@ export class CommonCartridgeExportService { organizationBuilder.addResourceToOrganization(resourceProps); } }); + + const tasks = lesson.tasks.getItems(); + tasks.forEach((task) => { + organizationBuilder.addResourceToOrganization(this.mapTaskToWebContentResource(task, version)); + }); }); } From 599ccf50d9b30833184414191dd8af7e280644a3 Mon Sep 17 00:00:00 2001 From: Firas Shmit Date: Tue, 28 Nov 2023 17:02:59 +0100 Subject: [PATCH 2/2] EW-359 modified test of export service --- .../common-cartridge-export.service.spec.ts | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/apps/server/src/modules/learnroom/service/common-cartridge-export.service.spec.ts b/apps/server/src/modules/learnroom/service/common-cartridge-export.service.spec.ts index 8cd788f7793..6630c242d34 100644 --- a/apps/server/src/modules/learnroom/service/common-cartridge-export.service.spec.ts +++ b/apps/server/src/modules/learnroom/service/common-cartridge-export.service.spec.ts @@ -77,7 +77,10 @@ describe('CommonCartridgeExportService', () => { {} as ComponentProperties, ], }); - tasks = taskFactory.buildListWithId(5); + tasks = taskFactory.buildListWithId(5, { + name: 'Task of a lesson', + lesson: lessons[0], + }); }); afterAll(async () => { @@ -148,6 +151,14 @@ describe('CommonCartridgeExportService', () => { }); }); + it('should add tasks of lesson to manifest file', () => { + const manifest = archive.getEntry('imsmanifest.xml')?.getData().toString(); + lessons[0].tasks.getItems().forEach((task) => { + expect(manifest).toContain(`${task.name}`); + expect(manifest).toContain(`identifier="i${task.id}" type="webcontent" intendeduse="unspecified"`); + }); + }); + it('should add version 1 information to manifest file', () => { const manifest = archive.getEntry('imsmanifest.xml')?.getData().toString(); expect(manifest).toContain(CommonCartridgeVersion.V_1_1_0); @@ -198,6 +209,14 @@ describe('CommonCartridgeExportService', () => { }); }); + it('should add tasks of lesson to manifest file', () => { + const manifest = archive.getEntry('imsmanifest.xml')?.getData().toString(); + lessons[0].tasks.getItems().forEach((task) => { + expect(manifest).toContain(`${task.name}`); + expect(manifest).toContain(`identifier="i${task.id}" type="webcontent" intendeduse="assignment"`); + }); + }); + it('should add version 3 information to manifest file', () => { const manifest = archive.getEntry('imsmanifest.xml')?.getData().toString(); expect(manifest).toContain(CommonCartridgeVersion.V_1_3_0);