mirror of https://github.com/bra1n/townsquare.git
fixing filter logic in index state to correctly get travelers not in the currently selected edition.
This commit is contained in:
parent
af0d944d45
commit
5700184fff
|
@ -28,8 +28,12 @@ const getRolesByEdition = (edition = editionJSON[0]) => {
|
||||||
const getTravellersNotInEdition = (edition = editionJSON[0]) => {
|
const getTravellersNotInEdition = (edition = editionJSON[0]) => {
|
||||||
return new Map(
|
return new Map(
|
||||||
rolesJSON
|
rolesJSON
|
||||||
.filter(r => r.team === "traveler")
|
.filter(
|
||||||
.filter(r => r.edition !== edition.id || !edition.roles.includes(r.id))
|
r =>
|
||||||
|
r.team === "traveler" &&
|
||||||
|
r.edition !== edition.id &&
|
||||||
|
!edition.roles.includes(r.id)
|
||||||
|
)
|
||||||
.map(role => [role.id, role])
|
.map(role => [role.id, role])
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -195,6 +199,7 @@ export default new Vuex.Store({
|
||||||
if (editionJSONbyId.has(edition.id)) {
|
if (editionJSONbyId.has(edition.id)) {
|
||||||
state.edition = editionJSONbyId.get(edition.id);
|
state.edition = editionJSONbyId.get(edition.id);
|
||||||
state.roles = getRolesByEdition(state.edition);
|
state.roles = getRolesByEdition(state.edition);
|
||||||
|
state.extraTravellers = getTravellersNotInEdition(state.edition);
|
||||||
} else {
|
} else {
|
||||||
state.edition = edition;
|
state.edition = edition;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue