From 971b9d703193da7863767ea1db468c3d8445830f Mon Sep 17 00:00:00 2001 From: viehlieb Date: Mon, 20 Feb 2023 23:20:47 +0100 Subject: [PATCH] add to_s.gsub3 --- lib/foodsoft_article_import/bnn.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/foodsoft_article_import/bnn.rb b/lib/foodsoft_article_import/bnn.rb index 129bf05..337a96e 100644 --- a/lib/foodsoft_article_import/bnn.rb +++ b/lib/foodsoft_article_import/bnn.rb @@ -74,9 +74,10 @@ module FoodsoftArticleImport # get scale prices if exists # article.merge!(:scale_quantity => row[40], :scale_price => row[41]) unless row[40].nil? or row[41].nil? unless row[37].nil? && row[65].nil? && row[66].nil? - price_per = row[66].gsub(',', '.').to_f + scale_factor = row[66].gsub(',', '.').to_f price = row[37].gsub(',', '.').to_f - article.merge!(:price_per => (price_per * price).to_s.gsub('.', ',')) + price_per = (scale_factor * price).to_s.gsub('.', ',') + article.merge!(:price_per => price_per) article.merge!(:unit_symbol => row[65] ) end