Feature(Item) now has subtype instead of primary as a field

This commit is contained in:
WBHarry 2025-07-11 14:18:19 +02:00
parent e9967a27ca
commit e2ca4506cd
5 changed files with 28 additions and 10 deletions

View file

@ -20,10 +20,18 @@ export default class DHAncestry extends BaseDataItem {
}
get primaryFeature() {
return this.features.find(x => x?.system?.primary) ?? (this.features.length > 0 ? {} : null);
return (
this.features.find(x => x?.system?.subType === CONFIG.DH.ITEM.featureSubTypes.primary) ??
(this.features.filter(x => !x).length > 0 ? {} : null)
);
}
get secondaryFeature() {
return this.features.find(x => !x?.system?.primary);
return (
this.features.find(x => x?.system?.subType === CONFIG.DH.ITEM.featureSubTypes.secondary) ??
(this.features.filter(x => !x || x.system.subType === CONFIG.DH.ITEM.featureSubTypes.primary).length > 1
? {}
: null)
);
}
}