Skip to content

Commit

Permalink
Fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dacook committed Aug 22, 2023
1 parent 285b41d commit 9d7dec7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 6 additions & 1 deletion app/services/order_cycle_distributed_products.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ def products_relation

def products_taxons_relation
Spree::Product.where(id: stocked_products).
joins("LEFT JOIN (SELECT DISTINCT ON(product_id) id, product_id, primary_taxon_id FROM spree_variants) first_variant ON spree_products.id = first_variant.product_id").
joins(
"LEFT JOIN
(SELECT DISTINCT ON(product_id) id, product_id, primary_taxon_id FROM spree_variants)
first_variant
ON spree_products.id = first_variant.product_id"
).
select("spree_products.*, first_variant.primary_taxon_id").
group("spree_products.id, first_variant.primary_taxon_id")
end
Expand Down
6 changes: 4 additions & 2 deletions spec/controllers/api/v0/products_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@

it "gets a single product" do
product.create_image!(attachment: image("thinking-cat.jpg"))
product.variants.create!(unit_value: "1", unit_description: "thing", price: 1, primary_taxon: taxon)
product.variants.create!(unit_value: "1", unit_description: "thing", price: 1,
primary_taxon: taxon)
product.variants.first.images.create!(attachment: image("thinking-cat.jpg"))
product.set_property("spree", "rocks")

Expand Down Expand Up @@ -253,7 +254,8 @@
end

it "filters results by product category" do
api_get :bulk_products, { page: 1, per_page: 15, q: { variants_primary_taxon_id_eq: taxon.id } },
api_get :bulk_products,
{ page: 1, per_page: 15, q: { variants_primary_taxon_id_eq: taxon.id } },
format: :json
expect(returned_product_ids).to eq [product3.id, product2.id]
end
Expand Down

0 comments on commit 9d7dec7

Please sign in to comment.