Commit 27450948 authored by Romain DELEAU's avatar Romain DELEAU

fix bug on supplementaryRole assignment in tasks on save loading

parent 5a322757
...@@ -298,11 +298,13 @@ export class AppComponent { ...@@ -298,11 +298,13 @@ export class AppComponent {
task.characters[index] = scenario.characters[i]; task.characters[index] = scenario.characters[i];
} }
}); });
task.supplementaryRole = Object.assign(new SupplementaryRole, task.supplementaryRole); if (task.supplementaryRole) {
let supplementaryRoleIndex: number | undefined = role.supplementaryRoles.findIndex(element => task.supplementaryRole = Object.assign(new SupplementaryRole, task.supplementaryRole);
element.name == task.supplementaryRole.name && element.color == task.supplementaryRole.color let supplementaryRoleIndex: number | undefined = role.supplementaryRoles.findIndex(element =>
); element.name == task.supplementaryRole.name && element.color == task.supplementaryRole.color
task.supplementaryRole = role.supplementaryRoles[supplementaryRoleIndex]; );
task.supplementaryRole = role.supplementaryRoles[supplementaryRoleIndex];
}
task.prerequireRessources = task.prerequireRessources.map((prerequireData: any) => Object.assign(new PrerequireRessource(), prerequireData)); task.prerequireRessources = task.prerequireRessources.map((prerequireData: any) => Object.assign(new PrerequireRessource(), prerequireData));
task.prerequireRessources.forEach((prerequire, index) => { task.prerequireRessources.forEach((prerequire, index) => {
if (scenario.ressources.some(element => element.name == prerequire.ressource.name && element.number == prerequire.ressource.number)) { if (scenario.ressources.some(element => element.name == prerequire.ressource.name && element.number == prerequire.ressource.number)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment