From fa688d48a5952496ecbde913693dbb9ceea0fdbe Mon Sep 17 00:00:00 2001 From: Claire Dagan Date: Tue, 24 Oct 2023 14:36:31 +0200 Subject: [PATCH] [Mission] fix save mission --- frontend/cypress/e2e/side_window/mission/create_mission.spec.ts | 2 ++ frontend/src/features/missions/MissionForm/MissionForm.tsx | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/cypress/e2e/side_window/mission/create_mission.spec.ts b/frontend/cypress/e2e/side_window/mission/create_mission.spec.ts index 4d3f7f3d4..b8e5f9c48 100644 --- a/frontend/cypress/e2e/side_window/mission/create_mission.spec.ts +++ b/frontend/cypress/e2e/side_window/mission/create_mission.spec.ts @@ -53,6 +53,7 @@ context('Mission', () => { expect(request.body.missionTypes[0]).equal('SEA') expect(request.body.missionTypes[1]).equal('LAND') expect(request.body.controlUnits.length).equal(1) + expect(request.body.isClosed).to.be.false const controlUnit = request.body.controlUnits[0] expect(controlUnit.administration).equal('DIRM / DM') expect(controlUnit.id).equal(10011) @@ -132,6 +133,7 @@ context('Mission', () => { cy.wait('@updateMission').then(({ request, response }) => { expect(response && response.statusCode).equal(200) expect(request.body.controlUnits[0].contact).equal(undefined) + expect(request.body.isClosed).to.be.true }) cy.get('*[data-cy="SideWindowHeader-title"]').contains('Missions et contrĂ´les') }) diff --git a/frontend/src/features/missions/MissionForm/MissionForm.tsx b/frontend/src/features/missions/MissionForm/MissionForm.tsx index 361a46edd..52bfb0f06 100644 --- a/frontend/src/features/missions/MissionForm/MissionForm.tsx +++ b/frontend/src/features/missions/MissionForm/MissionForm.tsx @@ -79,7 +79,7 @@ export function MissionForm({ id, isNewMission, selectedMission, setShouldValida validateForm({ ...values, isClosed: false }).then(errors => { if (_.isEmpty(errors)) { - dispatch(saveMission({ ...values, isClosed: true })) + dispatch(saveMission({ ...values, isClosed: false })) return }