Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: issue of multiple shipmentIds being passed even when the shipments are not used #228

Merged
merged 2 commits into from
Aug 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/views/InProgress.vue
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,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 @@ -328,11 +330,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 @@ -390,7 +392,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
Loading