From 8748051a0fda0aa92244b8683774907f7d3ad0ee Mon Sep 17 00:00:00 2001 From: Anton Date: Tue, 12 Dec 2023 12:32:00 +0100 Subject: [PATCH] Fix stock notifications on snapshots [SCI-9872] --- app/models/repository_stock_value.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/repository_stock_value.rb b/app/models/repository_stock_value.rb index 4c043d1a2..2f882ce3e 100644 --- a/app/models/repository_stock_value.rb +++ b/app/models/repository_stock_value.rb @@ -203,8 +203,10 @@ class RepositoryStockValue < ApplicationRecord end def send_low_stock_notification - repository_row = RepositoryRow.find(repository_cell.repository_row_id) - repository = Repository.find(repository_row.repository_id) + repository_row = repository_cell.repository_row + repository = repository_row.repository + + return unless repository.class.name == 'Repository' LowStockNotification.send_notifications({ repository_row_id: repository_cell.repository_row_id,