优化
This commit is contained in:
@@ -176,7 +176,6 @@ async function normalizeFixture(context) {
|
||||
`${BASE}/fee-pool?customerId=${encodeURIComponent(customerId)}&direction=ALL`)
|
||||
const poolData = poolResponse?.body?.data
|
||||
pool = rows(poolData).concat(rows(poolData?.items))
|
||||
.filter((item) => String(item?.sourceType ?? '') !== 'MANUAL_COST')
|
||||
const visible = new Set(pool.map((item) => id(item?.sourceId)))
|
||||
if ([...expectedSourceIds].every((source) => visible.has(source))) break
|
||||
await new Promise((resolve) => setTimeout(resolve, 500))
|
||||
@@ -185,6 +184,8 @@ async function normalizeFixture(context) {
|
||||
const attemptedSources = root.feeSources.map((raw) => {
|
||||
const order = orders.get(id(raw.orderId))
|
||||
const financeSource = poolBySource.get(sourceId(raw))
|
||||
|| pool.find((item) => String(item?.direction || '').toUpperCase() === 'PAYABLE'
|
||||
&& [raw.containerBookingId, raw.loadingPlanId].map(id).includes(id(item?.containerId)))
|
||||
return {
|
||||
raw, feeSourceId: financePoolId(financeSource), sourceFeeId: sourceId(raw), customerId: id(raw.customerId ?? customerId),
|
||||
direction: String(raw.direction ?? ''), currency: String(raw.currency ?? raw.currencyCode ?? '').toUpperCase(),
|
||||
@@ -199,9 +200,11 @@ async function normalizeFixture(context) {
|
||||
|| (isUnboundContainerCost(source.raw) && !hasContainerAllocations))
|
||||
return {
|
||||
root, customerId,
|
||||
sources: attemptedSources.filter((source) => source.feeSourceId && !isUnboundContainerCost(source.raw)),
|
||||
sources: attemptedSources.filter((source) => source.feeSourceId
|
||||
&& (!isUnboundContainerCost(source.raw) || hasContainerAllocations)),
|
||||
uncreatedSources,
|
||||
sourceMappings: attemptedSources.filter((source) => source.feeSourceId && !isUnboundContainerCost(source.raw))
|
||||
sourceMappings: attemptedSources.filter((source) => source.feeSourceId
|
||||
&& (!isUnboundContainerCost(source.raw) || hasContainerAllocations))
|
||||
.map((source) => ({ sourceFeeId: source.sourceFeeId, feeSourceId: source.feeSourceId,
|
||||
sourceType: source.raw?.sourceType ?? null, direction: source.direction })),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user