Skip to content

Commit

Permalink
(bug) unable to update product low stock alert
Browse files Browse the repository at this point in the history
  • Loading branch information
gnepud committed Jan 27, 2025
1 parent f24056a commit 2e55813
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Next release

- Fix a bug: unable to update product low stock alert

## v6.3.37 2025 January 22

- updated rails to 7.0.8.7
Expand Down
2 changes: 1 addition & 1 deletion app/services/product_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def notify_on_low_stock(product, stock_movements = nil)
return product unless product.low_stock_alert
return product unless product.low_stock_threshold

affected_stocks = stock_movements&.map { |m| m[:stock_type] }&.uniq
affected_stocks = stock_movements&.compact_blank&.map { |m| m[:stock_type] }&.uniq
if (product.stock['internal'] <= product.low_stock_threshold && affected_stocks&.include?('internal')) ||
(product.stock['external'] <= product.low_stock_threshold && affected_stocks&.include?('external'))
NotificationCenter.call type: 'notify_admin_low_stock_threshold',
Expand Down

0 comments on commit 2e55813

Please sign in to comment.