Move amount check in bonus amount decorator to postConstruct

This commit is contained in:
thepaperpilot 2023-05-12 10:59:41 -05:00
parent 502fa99f5d
commit 9fa5ec971a

View file

@ -69,14 +69,12 @@ export const bonusAmountDecorator: Decorator<
BaseBonusAmountFeature, BaseBonusAmountFeature,
GenericBonusAmountFeature GenericBonusAmountFeature
> = { > = {
preConstruct(feature) { postConstruct(feature) {
if (feature.amount === undefined) { if (feature.amount === undefined) {
console.error( console.error(
`Decorated feature ${feature.id} does not contain the required 'amount' property"` `Decorated feature ${feature.id} does not contain the required 'amount' property"`
); );
} }
},
postConstruct(feature) {
processComputable(feature, "bonusAmount"); processComputable(feature, "bonusAmount");
if (feature.totalAmount === undefined) { if (feature.totalAmount === undefined) {
feature.totalAmount = computed(() => feature.totalAmount = computed(() =>