From d3a8b3ca5912342d97e9007b4fa1a0db95117a9c Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Tue, 12 Jul 2022 16:53:07 +0200 Subject: [PATCH] Fix display of stock consumption in assigned items table [SCI-6974] --- app/services/repository_datatable_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/repository_datatable_service.rb b/app/services/repository_datatable_service.rb index dc4a834b1..ac47b2365 100644 --- a/app/services/repository_datatable_service.rb +++ b/app/services/repository_datatable_service.rb @@ -57,7 +57,7 @@ class RepositoryDatatableService .where(my_module_repository_rows: { my_module_id: @my_module }) if @repository.has_stock_management? repository_rows = repository_rows - .select('SUM(my_module_repository_rows.stock_consumption) AS "consumed_stock"') + .select('SUM(DISTINCT my_module_repository_rows.stock_consumption) AS "consumed_stock"') end else repository_rows = repository_rows