From 5700184fff352a8e8a7f7bc37127a06551ea9147 Mon Sep 17 00:00:00 2001 From: Dave Date: Sat, 9 Jan 2021 20:40:59 +0000 Subject: [PATCH] fixing filter logic in index state to correctly get travelers not in the currently selected edition. --- src/store/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 61ea65c..3165dc2 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -28,8 +28,12 @@ const getRolesByEdition = (edition = editionJSON[0]) => { const getTravellersNotInEdition = (edition = editionJSON[0]) => { return new Map( rolesJSON - .filter(r => r.team === "traveler") - .filter(r => r.edition !== edition.id || !edition.roles.includes(r.id)) + .filter( + r => + r.team === "traveler" && + r.edition !== edition.id && + !edition.roles.includes(r.id) + ) .map(role => [role.id, role]) ); }; @@ -195,6 +199,7 @@ export default new Vuex.Store({ if (editionJSONbyId.has(edition.id)) { state.edition = editionJSONbyId.get(edition.id); state.roles = getRolesByEdition(state.edition); + state.extraTravellers = getTravellersNotInEdition(state.edition); } else { state.edition = edition; }