This commit is contained in:
2023-03-13 22:25:52 +01:00
parent 9e6d5856b1
commit a3694c1673
2 changed files with 9 additions and 8 deletions

View File

@ -2388,9 +2388,10 @@ export class RdDActor extends RdDBaseActor {
/* -------------------------------------------- */
async creerTacheDepuisLivre(item, options = { renderSheet: true }) {
// TODO: déplacer vers Item pour livres
const nomTache = "Lire " + item.name;
const filterTacheLecture = it => it.type == 'tache' && it.name == nomTache;
let tachesExistantes = this.filterItems(filterTacheLecture);
const filterTacheLecture = it => it.name == nomTache;
let tachesExistantes = this.filterItems(filterTacheLecture, 'tache');
if (tachesExistantes.length == 0) {
const tache = {
name: nomTache, type: 'tache',
@ -2406,7 +2407,7 @@ export class RdDActor extends RdDBaseActor {
}
}
await this.createEmbeddedDocuments('Item', [tache], options);
tachesExistantes = this.filterItems(filterTacheLecture);
tachesExistantes = this.filterItems(filterTacheLecture, 'tache');
}
return tachesExistantes.length > 0 ? tachesExistantes[0] : undefined;
}