mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-26 01:33:22 +00:00
Merge pull request #12460 from mkllnk/enterprise-data-purge
Clean up unused enterprise fields
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class RemoveDistributorInfoFromEnterprises < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
remove_column :enterprises, :distributor_info, :text
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class RemovePickupTimesFromEnterprises < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
remove_column :enterprises, :pickup_times, :text
|
||||
end
|
||||
end
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user