From d8561beb49c82643d8a87931cc48743f01a6262a Mon Sep 17 00:00:00 2001 From: Nevio Di Gennaro Date: Tue, 14 Jan 2025 12:13:00 +0100 Subject: [PATCH] fix duplicate so you can choose which key results you wanna duplicate --- frontend/cypress/e2e/duplicate-objective.cy.ts | 2 ++ .../dialog/objective-dialog/objective-form.component.ts | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/cypress/e2e/duplicate-objective.cy.ts b/frontend/cypress/e2e/duplicate-objective.cy.ts index 9041affeaf..2f4487f394 100644 --- a/frontend/cypress/e2e/duplicate-objective.cy.ts +++ b/frontend/cypress/e2e/duplicate-objective.cy.ts @@ -2,6 +2,7 @@ import * as users from '../fixtures/users.json'; import CyOverviewPage from '../support/helper/dom-helper/pages/overviewPage'; import KeyResultDetailPage from '../support/helper/dom-helper/pages/keyResultDetailPage'; import ObjectiveDialog from '../support/helper/dom-helper/dialogs/objectiveDialog'; +import { wait } from 'cypress-real-events/utils'; let overviewPage = new CyOverviewPage(); @@ -42,6 +43,7 @@ describe('functionality of duplicating objectives and their belonging key-result .excludeKeyResults([secondKeyResultName, thirdKeyResultName]) .submit(); + wait(1000); overviewPage.getKeyResultOfObjective(duplicatedTitle, firstKeyResultName); diff --git a/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.ts b/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.ts index 282e56e233..ee90a1e97f 100644 --- a/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.ts +++ b/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.ts @@ -187,7 +187,9 @@ export class ObjectiveFormComponent implements OnInit, OnDestroy { objectiveDTO.state = 'DRAFT' as State; return this.objectiveService.duplicateObjective(id, { objective: objectiveDTO, - keyResultIds: this.keyResults.map((keyResult) => keyResult.id) + keyResultIds: this.keyResults + .filter((keyResult, index) => this.objectiveForm.value.keyResults?.[index] ?? false) + .map((keyResult) => keyResult.id) }); } else { if (this.data.action == 'releaseBacklog') {