Fix heure naissance et attaque sur véhicules
This commit is contained in:
		| @@ -1447,7 +1447,8 @@ export class RdDActor extends Actor { | ||||
|  | ||||
|   /* -------------------------------------------- */ | ||||
|   getSonne() { | ||||
|     return !this.isEntiteCauchemar() && (Misc.templateData(this).sante.sonne?.value ?? false); | ||||
|     let data = Misc.templateData(this);     | ||||
|     return !this.isEntiteCauchemar() && (data.sante?.sonne?.value ?? false); | ||||
|   } | ||||
|  | ||||
|   /* -------------------------------------------- */ | ||||
| @@ -3099,7 +3100,7 @@ export class RdDActor extends Actor { | ||||
|     let itemData = Misc.data(item); | ||||
|     if (itemData?.data) { | ||||
|       const isEquipe = !itemData.data.equipe; | ||||
|       let update = { _id: item._id, "data.equipe": isEquipe }; | ||||
|       let update = { _id: item.id, "data.equipe": isEquipe }; | ||||
|       await this.updateEmbeddedDocuments('Item', [update]); | ||||
|       this.computeEncombrementTotalEtMalusArmure(); // Mise à jour encombrement | ||||
|       this.computePrixTotalEquipement(); // Mis à jour du prix total de l'équipement | ||||
|   | ||||
| @@ -24,6 +24,11 @@ export class Grammar { | ||||
|     return words?.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "") ?? words; | ||||
|   } | ||||
|  | ||||
|   /* -------------------------------------------- */ | ||||
|   static toLowerCaseNoAccentNoSpace(words) { | ||||
|     return words?.toLowerCase().normalize("NFD").replace(/[ \u0300-\u036f]/g, "") ?? words; | ||||
|   } | ||||
|    | ||||
|   /* -------------------------------------------- */ | ||||
|   static articleDetermine(genre) { | ||||
|     switch (Grammar.toLowerCaseNoAccent(genre)) { | ||||
|   | ||||
| @@ -327,13 +327,14 @@ export class RdDCalendrier extends Application { | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   /* -------------------------------------------- */ | ||||
|   findHeure(heure) { | ||||
|     heure = Grammar.toLowerCaseNoAccent(heure); | ||||
|     let parHeureOuLabel = Object.values(heuresDef).filter(it => (it.heure+1) == heure || Grammar.toLowerCaseNoAccent(it.label) == heure); | ||||
|     let parHeureOuLabel = Object.values(heuresDef).filter(it => (it.heure+1) == heure || Grammar.toLowerCaseNoAccentNoSpace(it.label) == heure); | ||||
|     if (parHeureOuLabel.length == 1) { | ||||
|       return parHeureOuLabel[0]; | ||||
|     } | ||||
|     let parLabelPartiel = Object.values(heuresDef).filter(it => Grammar.toLowerCaseNoAccent(it.label).includes(heure)); | ||||
|     let parLabelPartiel = Object.values(heuresDef).filter(it => Grammar.toLowerCaseNoAccentNoSpace(it.label).includes(heure)); | ||||
|     const matchLength = heure.length; | ||||
|     if(parLabelPartiel.length > 0) { | ||||
|       parLabelPartiel.sort((a,b)=> (a.label.length - matchLength)^2 - (b.label.length- matchLength)^2); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user