mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-27 06:05:19 +00:00
Fix API v0 packing report
This commit is contained in:
@@ -19,8 +19,8 @@ module Reporting
|
||||
reflect query.join(association(Spree::Variant, :product))
|
||||
end
|
||||
|
||||
def joins_product_supplier
|
||||
reflect query.join(association(Spree::Product, :supplier, supplier_alias))
|
||||
def joins_variant_supplier
|
||||
reflect query.join(association(Spree::Variant, :supplier, supplier_alias))
|
||||
end
|
||||
|
||||
def joins_variant_shipping_category
|
||||
|
||||
@@ -18,7 +18,7 @@ module Reporting
|
||||
joins_order_bill_address.
|
||||
joins_variant.
|
||||
joins_variant_product.
|
||||
joins_product_supplier.
|
||||
joins_variant_supplier.
|
||||
joins_variant_shipping_category.
|
||||
selecting(select_fields).
|
||||
ordered_by(ordering_fields)
|
||||
|
||||
@@ -34,7 +34,7 @@ RSpec.describe Api::V0::ReportsController, type: :controller do
|
||||
|
||||
context "as an enterprise user with partial order permissions (supplier with P-OC)" do
|
||||
let!(:order) { create(:completed_order_with_totals) }
|
||||
let(:supplier) { order.line_items.first.product.supplier }
|
||||
let(:supplier) { order.line_items.first.variant.supplier }
|
||||
let(:current_user) { supplier.owner }
|
||||
let!(:perms) {
|
||||
create(:enterprise_relationship, parent: supplier, child: order.distributor,
|
||||
@@ -62,7 +62,7 @@ RSpec.describe Api::V0::ReportsController, type: :controller do
|
||||
{
|
||||
"hub" => line_item.order.distributor.name,
|
||||
"customer_code" => line_item.order.customer&.code,
|
||||
"supplier" => line_item.product.supplier.name,
|
||||
"supplier" => line_item.variant.supplier.name,
|
||||
"product" => line_item.product.name,
|
||||
"variant" => line_item.full_name,
|
||||
"quantity" => line_item.quantity,
|
||||
@@ -80,7 +80,7 @@ RSpec.describe Api::V0::ReportsController, type: :controller do
|
||||
'first_name' => '< Hidden >',
|
||||
'last_name' => '< Hidden >',
|
||||
'phone' => '< Hidden >',
|
||||
"supplier" => line_item.product.supplier.name,
|
||||
"supplier" => line_item.variant.supplier.name,
|
||||
"product" => line_item.product.name,
|
||||
"variant" => line_item.full_name,
|
||||
"quantity" => line_item.quantity,
|
||||
|
||||
Reference in New Issue
Block a user