12777: use unit_to_display method for variant unit

- This method prioritize display_as and after that considers options_text
This commit is contained in:
Ahmed Ejaz
2024-08-21 23:57:54 +05:00
committed by Sigmund Petersen
parent 0cf8f079e4
commit 983addff0d
3 changed files with 4 additions and 4 deletions

View File

@@ -2,5 +2,5 @@
= "#{line_item.product.name}"
- unless line_item.product.name.include? line_item.name_to_display
%span= "- #{line_item.name_to_display}"
- if line_item.options_text
= "(#{line_item.options_text})"
- if line_item.unit_to_display
= "(#{line_item.unit_to_display})"

View File

@@ -15,7 +15,7 @@ module Reporting
customer_city: proc { |line_item| line_item.order.bill_address.city },
sku: proc { |line_item| line_item.product.sku },
item_name: proc { |line_item| line_item.product.name },
variant: proc { |line_item| line_item.options_text },
variant: proc { |line_item| line_item.unit_to_display },
quantity: proc { |line_item| line_item.quantity },
max_quantity: proc { |line_item| line_item.max_quantity },
cost: proc { |line_item| line_item.price * line_item.quantity },

View File

@@ -60,7 +60,7 @@ RSpec.describe Reporting::Reports::OrdersAndDistributors::Base do
bill_address.city,
line_item.product.sku,
line_item.product.name,
line_item.options_text,
line_item.unit_to_display,
line_item.quantity,
line_item.max_quantity,
line_item.price * line_item.quantity,