Skip to content

Commit

Permalink
fix: takes pending account
Browse files Browse the repository at this point in the history
  • Loading branch information
jose-carlos-sousa committed Feb 8, 2025
1 parent 4f2110f commit 5f07662
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions website/app/controllers/orders_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,13 @@ export default class OrdersController {
.join('orders', 'order_products.order_id', 'orders.id')
.where('orders.user_id', userId)
.where('order_products.product_id', productId)
.where('orders.status', 'Success')
.whereIn('orders.status', ['Success', 'Pending'])

const stockUsed = successfulOrdersOfGivenProduct.reduce(
(acc, orderProduct) => acc + orderProduct.quantity,
0
)



const totalQuantity = successfulOrdersOfGivenProductPerUser.reduce(
(acc, orderProduct) => acc + orderProduct.quantity,
0
Expand Down

0 comments on commit 5f07662

Please sign in to comment.