From 159dba0dc3f7ef1a9fd8a7d4c2d6b1d02f06320e Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 13 Dec 2021 14:36:08 +0100 Subject: [PATCH] household member editor: do not add in new members if the member is included in the members of household --- .../HouseholdMembersEditor/store/index.js | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/store/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/store/index.js index 678fb98a0..cd43ee29c 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/store/index.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/store/index.js @@ -224,18 +224,21 @@ const store = createStore({ } state.concerned.forEach((c, index) => { - let m = { - id: index * -1, - person: c.person, - holder: c.holder, - position: c.position, - }; - if (c.position === null) { - m.position = { - ordering: 999999 + if (!(h.members.map((m) => m.person.id)).includes(c.person.id)) { + let m = { + id: index * -1, + person: c.person, + holder: c.holder, + position: c.position, + }; + if (c.position === null) { + m.position = { + ordering: 999999 + } } + h.new_members.push(m); } - h.new_members.push(m); + }) console.log('fake household', h);