Skip to content

Commit

Permalink
Merge pull request #228 from ymaheshwari1/fulfillment/fix-shipmentId
Browse files Browse the repository at this point in the history
Fixed: issue of multiple shipmentIds being passed even when the shipments are not used
  • Loading branch information
ravilodhi authored Aug 1, 2023
2 parents a8832f5 + 250d23e commit 029f77b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/views/InProgress.vue
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ export default defineComponent({
'orderId': order.orderId
}
const shipmentIds: Array<any> = [...new Set(order.items.map((item: any) => item.shipmentId))]
emitter.emit('presentLoader');
try {
const resp = await OrderService.packOrder(params);
Expand All @@ -335,11 +337,11 @@ export default defineComponent({
throw resp.data
}
if (data.includes('printPackingSlip') && data.includes('printShippingLabel')) {
await OrderService.printShippingLabelAndPackingSlip(order.shipmentIds)
await OrderService.printShippingLabelAndPackingSlip(shipmentIds)
} else if(data.includes('printPackingSlip')) {
await OrderService.printPackingSlip(order.shipmentIds)
await OrderService.printPackingSlip(shipmentIds)
} else if(data.includes('printShippingLabel')) {
await OrderService.printShippingLabel(order.shipmentIds)
await OrderService.printShippingLabel(shipmentIds)
}
// TODO: handle the case of fetching in progress orders after packing an order
// when packing an order the API runs too fast and the solr index does not update resulting in having the current packed order in the inProgress section
Expand Down Expand Up @@ -397,7 +399,7 @@ export default defineComponent({
// Considering only unique shipment IDs
// TODO check reason for redundant shipment IDs
const shipmentIds = [...new Set(orderList.map((order: any) => order.shipmentIds).flat())] as Array<string>
const shipmentIds = orderList.map((order: any) => [...new Set(order.items.map((item: any) => item.shipmentId).flat())]).flat() as Array<string>
try {
const resp = await OrderService.packOrders({
Expand Down

0 comments on commit 029f77b

Please sign in to comment.