mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-18 04:39:14 +00:00
Style indentation
This commit is contained in:
@@ -251,7 +251,7 @@ module Spree
|
||||
transaction do
|
||||
ExchangeVariant.
|
||||
where(exchange_variants: { variant_id: variants.with_deleted.
|
||||
select(:id) }).destroy_all
|
||||
select(:id) }).destroy_all
|
||||
|
||||
yield
|
||||
end
|
||||
|
||||
@@ -35,8 +35,8 @@ module Spree
|
||||
taxons
|
||||
.pluck('spree_taxons.id, enterprises.id AS enterprise_id')
|
||||
.each_with_object({}) do |(taxon_id, enterprise_id), collection|
|
||||
collection[enterprise_id.to_i] ||= Set.new
|
||||
collection[enterprise_id.to_i] << taxon_id
|
||||
collection[enterprise_id.to_i] ||= Set.new
|
||||
collection[enterprise_id.to_i] << taxon_id
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -167,8 +167,8 @@ module Spree
|
||||
# In Rails 3, merging two scopes on the same column will consider only the last scope.
|
||||
def self.in_distributor(distributor)
|
||||
where(id: ExchangeVariant.select(:variant_id).
|
||||
joins(:exchange).
|
||||
where('exchanges.incoming = ? AND exchanges.receiver_id = ?', false, distributor))
|
||||
joins(:exchange).
|
||||
where('exchanges.incoming = ? AND exchanges.receiver_id = ?', false, distributor))
|
||||
end
|
||||
|
||||
def self.indexed
|
||||
@@ -179,11 +179,11 @@ module Spree
|
||||
# "where(id:" is necessary so that the returned relation has no includes
|
||||
# The relation without includes will not be readonly and allow updates on it
|
||||
where(spree_variants: { id: joins(:prices).
|
||||
where(deleted_at: nil).
|
||||
where('spree_prices.currency' =>
|
||||
where(deleted_at: nil).
|
||||
where('spree_prices.currency' =>
|
||||
currency || CurrentConfig.get(:currency)).
|
||||
where.not(spree_prices: { amount: nil }).
|
||||
select("spree_variants.id") })
|
||||
where.not(spree_prices: { amount: nil }).
|
||||
select("spree_variants.id") })
|
||||
end
|
||||
|
||||
def self.linked_to(semantic_id)
|
||||
|
||||
@@ -42,10 +42,10 @@ class DfcCatalogImporter
|
||||
.includes(:semantic_links).references(:semantic_links)
|
||||
.where.not(semantic_links: { semantic_id: present_ids })
|
||||
.select do |variant|
|
||||
# Variants that were in the same catalog before:
|
||||
variant.semantic_links.map(&:semantic_id).any? do |semantic_id|
|
||||
FdcUrlBuilder.new(semantic_id).catalog_url == catalog_url
|
||||
end
|
||||
# Variants that were in the same catalog before:
|
||||
variant.semantic_links.map(&:semantic_id).any? do |semantic_id|
|
||||
FdcUrlBuilder.new(semantic_id).catalog_url == catalog_url
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -51,8 +51,8 @@ class LineItemSyncer
|
||||
def destroy_obsolete_items(order)
|
||||
order.line_items.
|
||||
where(variant_id: subscription_line_items.
|
||||
select(&:marked_for_destruction?).
|
||||
map(&:variant_id)).
|
||||
select(&:marked_for_destruction?).
|
||||
map(&:variant_id)).
|
||||
destroy_all
|
||||
end
|
||||
|
||||
|
||||
@@ -10,10 +10,10 @@ module Reporting
|
||||
.complete.not_state(:canceled)
|
||||
.order(:id))
|
||||
.group_by do |order|
|
||||
{
|
||||
customer_id: order.customer_id || order.email,
|
||||
hub_id: order.distributor_id,
|
||||
}
|
||||
{
|
||||
customer_id: order.customer_id || order.email,
|
||||
hub_id: order.distributor_id,
|
||||
}
|
||||
end.values
|
||||
end
|
||||
|
||||
|
||||
@@ -44,11 +44,11 @@ module Reporting
|
||||
.filter(&method(:filter_enterprise_fee_by_id))
|
||||
.filter(&method(:filter_enterprise_fee_by_owner))
|
||||
.map do |enterprise_fee_id, enterprise_fee_adjustment_ids|
|
||||
{
|
||||
enterprise_fee_id:,
|
||||
enterprise_fee_adjustment_ids:,
|
||||
order:
|
||||
}
|
||||
{
|
||||
enterprise_fee_id:,
|
||||
enterprise_fee_adjustment_ids:,
|
||||
order:
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -86,11 +86,11 @@ RSpec.describe Spree::Order do
|
||||
|
||||
(Spree::Shipment.state_machine.states.keys - [:pending, :backorder, :ready])
|
||||
.each do |shipment_state|
|
||||
it "should be false if shipment_state is #{shipment_state}" do
|
||||
allow(order).to receive_messages completed?: true
|
||||
order.shipment_state = shipment_state
|
||||
expect(order.can_cancel?).to be_falsy
|
||||
end
|
||||
it "should be false if shipment_state is #{shipment_state}" do
|
||||
allow(order).to receive_messages completed?: true
|
||||
order.shipment_state = shipment_state
|
||||
expect(order.can_cancel?).to be_falsy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ RSpec.describe Spree::User do
|
||||
bill_address_attributes: new_bill_address.dup.attributes.merge(
|
||||
'id' => old_bill_address.id
|
||||
)
|
||||
.except!('created_at', 'updated_at')
|
||||
.except!('created_at', 'updated_at')
|
||||
)
|
||||
|
||||
expect(user.bill_address.id).to eq old_bill_address.id
|
||||
|
||||
@@ -38,8 +38,8 @@ RSpec.shared_examples "attribute changes - tax total changes" do |boolean, type,
|
||||
create(:order_with_taxes, product_price: 110, tax_rate_amount: 0.1,
|
||||
included_in_price: included_boolean)
|
||||
.tap do |order|
|
||||
order.create_tax_charge!
|
||||
order.update_shipping_fees!
|
||||
order.create_tax_charge!
|
||||
order.update_shipping_fees!
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1044,10 +1044,10 @@ RSpec.describe '
|
||||
page.driver
|
||||
.dismiss_modal :confirm,
|
||||
text: "Unsaved changes exist and will be lost if you continue." do
|
||||
within "tr#li_#{li1.id}" do
|
||||
fill_in "quantity", with: (li1.quantity + 1)
|
||||
find("a.edit-order").click
|
||||
end
|
||||
within "tr#li_#{li1.id}" do
|
||||
fill_in "quantity", with: (li1.quantity + 1)
|
||||
find("a.edit-order").click
|
||||
end
|
||||
end
|
||||
|
||||
# So we save the changes
|
||||
|
||||
@@ -360,10 +360,10 @@ RSpec.describe "As a consumer, I want to checkout my order" do
|
||||
# And fake the payment status to avoid user interaction.
|
||||
allow_any_instance_of(Taler::Client)
|
||||
.to receive(:fetch_order) do
|
||||
payment = Spree::Payment.last
|
||||
url = payment_gateways_confirm_taler_path(payment_id: payment.id)
|
||||
payment = Spree::Payment.last
|
||||
url = payment_gateways_confirm_taler_path(payment_id: payment.id)
|
||||
|
||||
{ "order_status_url" => url, "order_status" => "paid" }
|
||||
{ "order_status_url" => url, "order_status" => "paid" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user