From 37617f63ea884a3aa22749f51234a2a0910f705e Mon Sep 17 00:00:00 2001 From: Cillian O'Ruanaidh Date: Wed, 8 Jun 2022 19:54:28 +0100 Subject: [PATCH] Remove non-functional :backend scope from Spree::ShippingRate It finds shipping methods where 'display_on != front_end' but :front_end values were removed in https://github.com/openfoodfoundation/openfoodnetwork/blob/a1317be19b76d1953e38f9e47cbc8e5304d275e6/db/migrate/20200508101630_convert_frontend_shipping_method_to_both.rb so it will always return true. --- app/models/spree/shipping_rate.rb | 7 ------- app/views/spree/admin/orders/_shipment.html.haml | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/app/models/spree/shipping_rate.rb b/app/models/spree/shipping_rate.rb index 710a8a25b4..ce94b5f808 100644 --- a/app/models/spree/shipping_rate.rb +++ b/app/models/spree/shipping_rate.rb @@ -12,13 +12,6 @@ module Spree references(:shipping_method). order("cost ASC") } - scope :backend, - -> { - includes(:shipping_method). - where(ShippingMethod.on_backend_query). - references(:shipping_method). - order("cost ASC") - } delegate :order, :currency, to: :shipment delegate :name, to: :shipping_method diff --git a/app/views/spree/admin/orders/_shipment.html.haml b/app/views/spree/admin/orders/_shipment.html.haml index e9fcb169de..653f93ea5c 100644 --- a/app/views/spree/admin/orders/_shipment.html.haml +++ b/app/views/spree/admin/orders/_shipment.html.haml @@ -38,7 +38,7 @@ %td{ :colspan => "5" } %div.field.alpha.five.columns = label_tag 'selected_shipping_rate_id', Spree.t(:shipping_method) - = select_tag :selected_shipping_rate_id, options_for_select(shipment.shipping_rates.backend.map { |sr| ["#{sr.name} #{sr.display_price}", sr.id] }, shipment.selected_shipping_rate_id), { :class => 'select2 fullwidth', :data => { 'shipment-number' => shipment.number } } + = select_tag :selected_shipping_rate_id, options_for_select(shipment.shipping_rates.map { |sr| ["#{sr.name} #{sr.display_price}", sr.id] }, shipment.selected_shipping_rate_id), { :class => 'select2 fullwidth', :data => { 'shipment-number' => shipment.number } } %td.actions - if can? :update, shipment