Cleanup Promise.all pour multi async
This commit is contained in:
parent
19dd3b540c
commit
042f5d0f69
@ -347,7 +347,7 @@ export class RdDActor extends RdDBaseActorSang {
|
|||||||
const timestamp = game.system.rdd.calendrier.getTimestamp()
|
const timestamp = game.system.rdd.calendrier.getTimestamp()
|
||||||
const blessures = this.filterItems(it => it.system.gravite > 0, TYPES.blessure).sort(Misc.ascending(it => it.system.gravite))
|
const blessures = this.filterItems(it => it.system.gravite > 0, TYPES.blessure).sort(Misc.ascending(it => it.system.gravite))
|
||||||
|
|
||||||
await Promise.all(blessures.map(b => b.recuperationBlessure({
|
await Promise.all(blessures.map(async b => b.recuperationBlessure({
|
||||||
actor: this,
|
actor: this,
|
||||||
timestamp,
|
timestamp,
|
||||||
message,
|
message,
|
||||||
|
@ -71,17 +71,17 @@ class _10_0_16_MigrationSortsReserve extends Migration {
|
|||||||
get version() { return "10.0.16"; }
|
get version() { return "10.0.16"; }
|
||||||
|
|
||||||
async migrate() {
|
async migrate() {
|
||||||
await game.actors
|
const actors = game.actors.filter((actor) => actor.type == "personnage" && (actor.system.reve?.reserve?.list?.length ?? 0 > 0))
|
||||||
.filter((actor) => actor.type == "personnage")
|
Promise.all(actors.map(async it => await this.convertirSortsReserveActeur(it)))
|
||||||
.filter((actor) => actor.system.reve?.reserve?.list?.length ?? 0 > 0)
|
}
|
||||||
.forEach(async (actor) => {
|
|
||||||
const sortsReserve = actor.system.reve.reserve.list.map(this.conversionSortReserve);
|
async convertirSortsReserveActeur(actor) {
|
||||||
console.log(`${LOG_HEAD} Migration des sorts en réserve de ${actor.name}`, sortsReserve);
|
const sortsReserve = actor.system.reve.reserve.list.map(this.conversionSortReserve);
|
||||||
await actor.createEmbeddedDocuments("Item", sortsReserve, {
|
console.log(`${LOG_HEAD} Migration des sorts en réserve de ${actor.name}`, sortsReserve);
|
||||||
renderSheet: false,
|
await actor.createEmbeddedDocuments("Item", sortsReserve, {
|
||||||
});
|
renderSheet: false,
|
||||||
await actor.update({ 'system.reve.reserve': undefined })
|
});
|
||||||
});
|
await actor.update({ 'system.reve.reserve': undefined });
|
||||||
}
|
}
|
||||||
|
|
||||||
conversionSortReserve(it) {
|
conversionSortReserve(it) {
|
||||||
@ -508,7 +508,8 @@ class _10_7_19_PossessionsEntiteVictime extends Migration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
migratePossession(it) {
|
migratePossession(it) {
|
||||||
return { _id: it.id,
|
return {
|
||||||
|
_id: it.id,
|
||||||
'system.entite.actorid': it.system.possesseurid,
|
'system.entite.actorid': it.system.possesseurid,
|
||||||
'system.victime.actorid': it.system.possedeid
|
'system.victime.actorid': it.system.possedeid
|
||||||
}
|
}
|
||||||
@ -573,7 +574,7 @@ export class Migrations {
|
|||||||
migrations.sort((a, b) => this.compareVersions(a, b));
|
migrations.sort((a, b) => this.compareVersions(a, b));
|
||||||
migrations.forEach(async (m) => {
|
migrations.forEach(async (m) => {
|
||||||
ui.notifications.info(
|
ui.notifications.info(
|
||||||
`Executing migration ${m.code}: version ${currentVersion} is lower than ${m.version}`
|
`${LOG_HEAD} Executing migration ${m.code}: version ${currentVersion} is lower than ${m.version}`
|
||||||
);
|
);
|
||||||
await m.migrate();
|
await m.migrate();
|
||||||
});
|
});
|
||||||
@ -581,9 +582,7 @@ export class Migrations {
|
|||||||
`Migrations done, version will change to ${game.system.version}`
|
`Migrations done, version will change to ${game.system.version}`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
console.log(
|
console.log(`${LOG_HEAD} No migration needeed, version will change to ${game.system.version}`
|
||||||
LOG_HEAD +
|
|
||||||
`No migration needeed, version will change to ${game.system.version}`
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -593,7 +592,7 @@ export class Migrations {
|
|||||||
game.system.version
|
game.system.version
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
console.log(LOG_HEAD + `No system version changed`);
|
console.log(`${LOG_HEAD} No system version changed`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user