fix: Update sorting and calculation of available quantity in GetLowStockItems query
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 1m46s
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 1m46s
This commit is contained in:
+2
-2
@@ -26,7 +26,7 @@ public class GetLowStockItemsQueryHandler : IRequestHandler<GetLowStockItemsQuer
|
||||
var totalCount = await query.CountAsync(cancellationToken);
|
||||
|
||||
var items = await query
|
||||
.OrderBy(i => i.AvailableQuantity)
|
||||
.OrderBy(i => i.Quantity - i.ReservedQuantity)
|
||||
.Take(request.Count)
|
||||
.Select(i => new LowStockItemDto
|
||||
{
|
||||
@@ -39,7 +39,7 @@ public class GetLowStockItemsQueryHandler : IRequestHandler<GetLowStockItemsQuer
|
||||
ProductTitle = i.Product != null ? i.Product.Title : (i.DiscountProduct != null ? i.DiscountProduct.Title : null),
|
||||
Quantity = i.Quantity,
|
||||
ReservedQuantity = i.ReservedQuantity,
|
||||
AvailableQuantity = i.AvailableQuantity,
|
||||
AvailableQuantity = i.Quantity - i.ReservedQuantity,
|
||||
LowStockThreshold = i.LowStockThreshold
|
||||
})
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
Reference in New Issue
Block a user