Merge pull request #7707 from aignatov-bio/ai-sci-10855-add-negative-numbers-to-stock

Add negative stock values to import [SCI-10855]
This commit is contained in:
aignatov-bio 2024-07-15 10:30:13 +02:00 committed by GitHub
commit 694432ffa9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -167,7 +167,7 @@ class RepositoryStockValue < ApplicationRecord
end
def self.import_from_text(text, attributes, _options = {})
digit, unit = text.match(/(^\d*\.?\d*)(\D*)/).captures
digit, unit = text.match(/(^-?\d*\.?\d*)(\D*)/).captures
digit.strip!
unit.strip!
return nil if digit.blank?