Fix creating RepositoryStockConsumptionValues in repository snapshots [SCI-10908]

This commit is contained in:
Martin Artnik 2024-07-23 10:30:07 +02:00 committed by Andrej
parent 121a30ede6
commit 70a03db57a

View file

@ -52,7 +52,16 @@ class RepositoryCell < ApplicationRecord
} }
def update_repository_row_last_modified_by def update_repository_row_last_modified_by
repository_row.update!(last_modified_by_id: value.last_modified_by_id) # RepositoryStockConsumptionValue currently don't store last_modified_by
# so this would fail. Should probably be refactored to unify the behaviour (23.7.2024)
if value.last_modified_by_id
repository_row.update!(last_modified_by_id: value.last_modified_by_id)
else
Rails.logger.warn(
"Missing last_modified_by_id for #{value.class} with id #{value.id}, " \
"skipping update of last_modified_by on RepositoryRow with id #{repository_row_id}."
)
end
end end
def self.create_with_value!(row, column, data, user) def self.create_with_value!(row, column, data, user)