From ac475e39ce1d014ddacd72a6e6e0ecc76eefd0c5 Mon Sep 17 00:00:00 2001 From: Ben Finney Date: Wed, 24 Jun 2020 22:40:01 +1000 Subject: [PATCH] Store characters in the order specified in the script. This corrects issue #38 by following the script sequence (not the catalogue of characters) for storing the characters. --- src/store/index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 0c52dbd..3355e9d 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -100,10 +100,12 @@ export default new Vuex.Store({ }, setRoles(state, roleIds) { state.roles = new Map( - rolesJSON - .filter(r => roleIds.includes(r.id)) - .sort((a, b) => b.team.localeCompare(a.team)) - .map(role => [role.id, role]) + roleIds + .filter(roleId => rolesJSONbyId.has(roleId)) + .sort((a, b) => + rolesJSONbyId.get(b).team.localeCompare(rolesJSONbyId.get(a).team) + ) + .map(roleId => [roleId, rolesJSONbyId.get(roleId)]) ); }, setEdition(state, edition) {