Skip to content

Commit

Permalink
fix: fixes migrations for untrained skill
Browse files Browse the repository at this point in the history
Fixes an issue with the accessing the id of untrained skills
during migrations
  • Loading branch information
jonepatr authored and xdy committed Jan 15, 2021
1 parent f02caf8 commit e6fdec7
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/module/migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ export class Migration {
private static async migrateActorData(actor:TwodsixActor):Promise<UpdateData> {
const updateData:UpdateData = <UpdateData>{};

let untrainedSkill = actor.getUntrainedSkill();
if (!untrainedSkill) {
untrainedSkill = await actor.buildUntrainedSkill();
updateData['data.untrainedSkill'] = untrainedSkill.id;
let untrainedSkill;
if (actor.data.type == "traveller") {
untrainedSkill = actor.getUntrainedSkill();
if (!untrainedSkill) {
untrainedSkill = await actor.buildUntrainedSkill();
updateData['data.untrainedSkill'] = untrainedSkill._id;
}
}

//TODO Get rid of the untrainedSkill passing
Expand Down Expand Up @@ -44,10 +47,10 @@ export class Migration {
}
}

if (actor) {
if (actor && actor.data.type === "traveller") {
if (item.type !== 'skills') {
if (!item.data.skill) { //0.6.84
updateData['data.skill'] = untrainedSkill.id;
updateData['data.skill'] = untrainedSkill._id;
}
}
}
Expand Down

0 comments on commit e6fdec7

Please sign in to comment.