diff --git a/app/models/order_cycle.rb b/app/models/order_cycle.rb index 7b71a3a79e..060f75e4f0 100644 --- a/app/models/order_cycle.rb +++ b/app/models/order_cycle.rb @@ -253,7 +253,7 @@ class OrderCycle < ApplicationRecord end def pickup_time_for(distributor) - exchange_for_distributor(distributor)&.pickup_time || distributor.next_collection_at + exchange_for_distributor(distributor)&.pickup_time end def pickup_instructions_for(distributor) diff --git a/app/views/spree/orders/edit.html.haml b/app/views/spree/orders/edit.html.haml index fb50b995eb..30811833b9 100644 --- a/app/views/spree/orders/edit.html.haml +++ b/app/views/spree/orders/edit.html.haml @@ -13,8 +13,6 @@ %strong - if @order.order_cycle = pickup_time @order.order_cycle - - else - = @order.distributor.next_collection_at - content_for :ordercycle_sidebar do .show-for-large-up.large-4.columns diff --git a/db/migrate/20240510040639_remove_distributor_info_from_enterprises.rb b/db/migrate/20240510040639_remove_distributor_info_from_enterprises.rb new file mode 100644 index 0000000000..3ead73c8a7 --- /dev/null +++ b/db/migrate/20240510040639_remove_distributor_info_from_enterprises.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class RemoveDistributorInfoFromEnterprises < ActiveRecord::Migration[7.0] + def change + remove_column :enterprises, :distributor_info, :text + end +end diff --git a/db/migrate/20240510041114_remove_pickup_times_from_enterprises.rb b/db/migrate/20240510041114_remove_pickup_times_from_enterprises.rb new file mode 100644 index 0000000000..bfe62525a6 --- /dev/null +++ b/db/migrate/20240510041114_remove_pickup_times_from_enterprises.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class RemovePickupTimesFromEnterprises < ActiveRecord::Migration[7.0] + def change + remove_column :enterprises, :pickup_times, :text + end +end diff --git a/db/migrate/20240510041829_remove_next_collection_at_from_enterprises.rb b/db/migrate/20240510041829_remove_next_collection_at_from_enterprises.rb new file mode 100644 index 0000000000..bce671833f --- /dev/null +++ b/db/migrate/20240510041829_remove_next_collection_at_from_enterprises.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class RemoveNextCollectionAtFromEnterprises < ActiveRecord::Migration[7.0] + def change + remove_column :enterprises, :next_collection_at, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 1cbb2938fa..90f54fd79a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2024_05_01_075735) do +ActiveRecord::Schema[7.0].define(version: 2024_05_10_041114) do # These are extensions that must be enabled in order to support this database enable_extension "pg_stat_statements" enable_extension "plpgsql" @@ -204,11 +204,9 @@ ActiveRecord::Schema[7.0].define(version: 2024_05_01_075735) do t.string "abn", limit: 255 t.string "acn", limit: 255 t.integer "address_id" - t.text "pickup_times" t.string "next_collection_at", limit: 255 t.datetime "created_at", precision: nil, null: false t.datetime "updated_at", precision: nil, null: false - t.text "distributor_info" t.string "facebook", limit: 255 t.string "instagram", limit: 255 t.string "linkedin", limit: 255 diff --git a/lib/tasks/enterprises.rake b/lib/tasks/enterprises.rake index bc97529547..fa735853c2 100644 --- a/lib/tasks/enterprises.rake +++ b/lib/tasks/enterprises.rake @@ -31,8 +31,8 @@ namespace :ofn do def enterprise_header ['name', 'description', 'long_description', 'is_primary_producer', 'is_distributor', - 'contact_name', 'phone', 'email', 'website', 'twitter', 'abn', 'acn', 'pickup_times', - 'next_collection_at', 'distributor_info', 'visible', 'facebook', 'instagram', 'linkedin', + 'contact_name', 'phone', 'email', 'website', 'twitter', 'abn', 'acn', + 'visible', 'facebook', 'instagram', 'linkedin', 'address1', 'address2', 'city', 'zipcode', 'state', 'country'] end @@ -40,8 +40,8 @@ namespace :ofn do [enterprise.name, enterprise.description, enterprise.long_description, enterprise.is_primary_producer, enterprise.is_distributor, enterprise.contact_name, enterprise.phone, enterprise.email, enterprise.website, enterprise.twitter, enterprise.abn, - enterprise.acn, enterprise.pickup_times, enterprise.next_collection_at, - enterprise.distributor_info, enterprise.visible, enterprise.facebook, enterprise.instagram, + enterprise.acn, + enterprise.visible, enterprise.facebook, enterprise.instagram, enterprise.linkedin, enterprise.address.address1, enterprise.address.address2, enterprise.address.city, enterprise.address.zipcode, enterprise.address.state_name, enterprise.address.country&.name] diff --git a/spec/models/order_cycle_spec.rb b/spec/models/order_cycle_spec.rb index 39095af2f6..b673da05e9 100644 --- a/spec/models/order_cycle_spec.rb +++ b/spec/models/order_cycle_spec.rb @@ -272,7 +272,7 @@ RSpec.describe OrderCycle do @oc = create(:simple_order_cycle) @d1 = create(:enterprise) - @d2 = create(:enterprise, next_collection_at: '2-8pm Friday') + @d2 = create(:enterprise) @e0 = create(:exchange, order_cycle: @oc, sender: create(:enterprise), receiver: @oc.coordinator, incoming: true) @@ -292,10 +292,6 @@ RSpec.describe OrderCycle do it "looks up the pickup time on the exchange when present" do expect(@oc.pickup_time_for(@d1)).to eq('5pm Tuesday') end - - it "returns the distributor's default collection time otherwise" do - expect(@oc.pickup_time_for(@d2)).to eq('2-8pm Friday') - end end describe "finding pickup instructions for a distributor" do