Skip to content

Commit

Permalink
fix(admin-ui): Fulfillment button takes existing state into account
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Aug 7, 2023
1 parent 571b157 commit ef357cd
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,9 @@ export class OrderDetailComponent
}

canAddFulfillment(order: OrderDetailFragment): boolean {
const allFulfillmentLines: FulfillmentFragment['lines'] = (order.fulfillments ?? []).reduce(
(all, fulfillment) => [...all, ...fulfillment.lines],
[] as FulfillmentFragment['lines'],
);
const allFulfillmentLines: FulfillmentFragment['lines'] = (order.fulfillments ?? [])
.filter(fulfillment => fulfillment.state !== 'Cancelled')
.reduce((all, fulfillment) => [...all, ...fulfillment.lines], [] as FulfillmentFragment['lines']);
let allItemsFulfilled = true;
for (const line of order.lines) {
const totalFulfilledCount = allFulfillmentLines
Expand Down

0 comments on commit ef357cd

Please sign in to comment.