Skip to content

Commit

Permalink
Fixes error when displaying old units
Browse files Browse the repository at this point in the history
  • Loading branch information
lentschi committed Nov 3, 2024
1 parent 5a7f487 commit 52b31dd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/helpers/orders_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ def pkg_helper(article, options = {})
unit_code = options[:unit] || article.supplier_order_unit
if unit_code == article.supplier_order_unit
first_ratio = article&.article_unit_ratios&.first
return ArticleUnitsLib.human_readable_unit(unit_code) if first_ratio.nil? || first_ratio.quantity == 1
if first_ratio.nil? || first_ratio.quantity == 1
return "x #{article.unit}" if unit_code.nil?

return ArticleUnitsLib.human_readable_unit(unit_code)
end

uq_text = #{number_with_precision(first_ratio.quantity, precision: 3, strip_insignificant_zeros: true)} #{ArticleUnitsLib.human_readable_unit(first_ratio.unit)}"
else
Expand Down

0 comments on commit 52b31dd

Please sign in to comment.