Merge branch 'issue/38/characters-in-script-order'

This commit is contained in:
Steffen 2020-06-30 09:46:23 +02:00
commit 8a982eace2
No known key found for this signature in database
GPG Key ID: 764D74E98267DFC6
1 changed files with 9 additions and 5 deletions

View File

@ -9,6 +9,8 @@ import rolesJSON from "../roles.json";
Vue.use(Vuex);
const rolesJSONbyId = new Map(rolesJSON.map(role => [role.id, role]));
const getRolesByEdition = (edition = "tb") => {
const selectedEdition =
editionJSON.find(({ id }) => id === edition) || editionJSON[0];
@ -96,12 +98,14 @@ export default new Vuex.Store({
grimoire.isScreenshot = false;
}
},
setRoles(state, roles) {
setRoles(state, roleIds) {
state.roles = new Map(
rolesJSON
.filter(r => roles.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) {