mirror of
https://github.com/valitydev/control-center.git
synced 2024-11-06 02:25:17 +00:00
FIN-45: Fix fee calc (#365)
This commit is contained in:
parent
310572e799
commit
26832f6087
@ -24,7 +24,7 @@ export function createFeesColumns<T extends object>(
|
||||
{
|
||||
field: 'condition',
|
||||
formatter: (d) =>
|
||||
getInlineDecisions(getFees(d))
|
||||
getInlineDecisions(getFees(d), filterFee)
|
||||
.filter(filterDecisions(d))
|
||||
.map((v) => formatLevelPredicate(v)),
|
||||
},
|
||||
|
@ -67,11 +67,11 @@ export function getInlineDecisions(
|
||||
): InlineCashFlowSelector[] {
|
||||
return d.reduce((acc, c) => {
|
||||
if (c.value) {
|
||||
const value = c.value.filter(filterValue);
|
||||
acc.push({
|
||||
value: formatCashVolumes(c.value.filter(filterValue).map((v) => v.volume)),
|
||||
value: formatCashVolumes(value.map((v) => v.volume)),
|
||||
level,
|
||||
description: c.value
|
||||
.filter(filterValue)
|
||||
description: value
|
||||
.sort((a, b) => compareCashVolumes(a.volume, b.volume))
|
||||
.map(
|
||||
(v) =>
|
||||
|
@ -28,12 +28,15 @@ export function formatCashVolume(d: CashVolume) {
|
||||
(d?.share?.of === 2 ? ' of surplus' : '') +
|
||||
(d?.share?.rounding_method === 1 ? ' (round .5+)' : '')
|
||||
);
|
||||
case 'product':
|
||||
return getUnionValue(d.product).size <= 1
|
||||
? formatCashVolume(getUnionValue(d.product)[0])
|
||||
: `${getUnionKey(d.product).slice(0, -3)}(${Array.from(getUnionValue(d.product))
|
||||
.sort(compareCashVolumes)
|
||||
.map((c) => formatCashVolume(c))
|
||||
.join(', ')})`;
|
||||
case 'product': {
|
||||
const products = Array.from(getUnionValue(d.product));
|
||||
if (products.length === 1) {
|
||||
return formatCashVolume(products[0]);
|
||||
}
|
||||
return `${getUnionKey(d.product).slice(0, -3)}(${products
|
||||
.sort(compareCashVolumes)
|
||||
.map((c) => formatCashVolume(c))
|
||||
.join(', ')})`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user