mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-05 02:41:33 +00:00
Remove receival_time from exchange, just use receival_instructions
This commit is contained in:
@@ -5,7 +5,6 @@ class ProducerMailer < Spree::BaseMailer
|
||||
@coordinator = order_cycle.coordinator
|
||||
@order_cycle = order_cycle
|
||||
@line_items = aggregated_line_items_from(@order_cycle, @producer)
|
||||
@receival_time = @order_cycle.receival_time_for @producer
|
||||
@receival_instructions = @order_cycle.receival_instructions_for @producer
|
||||
|
||||
subject = "[#{Spree::Config.site_name}] Order cycle report for #{producer.name}"
|
||||
|
||||
@@ -200,10 +200,6 @@ class OrderCycle < ActiveRecord::Base
|
||||
exchanges.incoming.from_enterprises([supplier]).first
|
||||
end
|
||||
|
||||
def receival_time_for(supplier)
|
||||
exchange_for_supplier(supplier).andand.receival_time
|
||||
end
|
||||
|
||||
def receival_instructions_for(supplier)
|
||||
exchange_for_supplier(supplier).andand.receival_instructions
|
||||
end
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
selected
|
||||
- if type == 'supplier'
|
||||
%td.receival-details
|
||||
= text_field_tag 'order_cycle_incoming_exchange_{{ $index }}_receival_time', '', 'id' => 'order_cycle_incoming_exchange_{{ $index }}_receival_time', 'placeholder' => 'Receive at (ie. Date / Time)', 'ng-model' => 'exchange.receival_time'
|
||||
%br/
|
||||
= text_field_tag 'order_cycle_incoming_exchange_{{ $index }}_receival_instructions', '', 'id' => 'order_cycle_incoming_exchange_{{ $index }}_receival_instructions', 'placeholder' => 'Receival instructions', 'ng-model' => 'exchange.receival_instructions'
|
||||
- if type == 'distributor'
|
||||
%td.collection-details
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Dear #{@producer.name},
|
||||
\
|
||||
We now have all the consumer orders for next food drop. Please drop off your delivery at #{@receival_time}.
|
||||
We now have all the consumer orders for next food drop.
|
||||
|
||||
- if @receival_instructions
|
||||
Extra instructions: #{@receival_instructions}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
class CombineExchangeReceivalTimeReceivalInstructions < ActiveRecord::Migration
|
||||
def up
|
||||
remove_column :exchanges, :receival_time
|
||||
end
|
||||
|
||||
def down
|
||||
add_column :exchanges, :receival_time, :string
|
||||
end
|
||||
end
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20151002020537) do
|
||||
ActiveRecord::Schema.define(:version => 20151125051510) do
|
||||
|
||||
create_table "account_invoices", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
@@ -386,7 +386,6 @@ ActiveRecord::Schema.define(:version => 20151002020537) do
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.boolean "incoming", :default => false, :null => false
|
||||
t.string "receival_time"
|
||||
t.string "receival_instructions"
|
||||
end
|
||||
|
||||
@@ -671,9 +670,9 @@ ActiveRecord::Schema.define(:version => 20151002020537) do
|
||||
t.string "email"
|
||||
t.text "special_instructions"
|
||||
t.integer "distributor_id"
|
||||
t.integer "order_cycle_id"
|
||||
t.string "currency"
|
||||
t.string "last_ip_address"
|
||||
t.integer "order_cycle_id"
|
||||
t.integer "cart_id"
|
||||
t.integer "customer_id"
|
||||
end
|
||||
|
||||
@@ -24,12 +24,10 @@ module OpenFoodNetwork
|
||||
if exchange_exists?(exchange[:enterprise_id], @order_cycle.coordinator_id, true)
|
||||
update_exchange(exchange[:enterprise_id], @order_cycle.coordinator_id, true,
|
||||
{variant_ids: variant_ids, enterprise_fee_ids: enterprise_fee_ids,
|
||||
receival_time: exchange[:receival_time],
|
||||
receival_instructions: exchange[:receival_instructions]})
|
||||
else
|
||||
add_exchange(exchange[:enterprise_id], @order_cycle.coordinator_id, true,
|
||||
{variant_ids: variant_ids, enterprise_fee_ids: enterprise_fee_ids,
|
||||
receival_time: exchange[:receival_time],
|
||||
receival_instructions: exchange[:receival_instructions],})
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,10 +16,10 @@ FactoryGirl.define do
|
||||
# Incoming Exchanges
|
||||
ex1 = create(:exchange, :order_cycle => oc, :incoming => true,
|
||||
:sender => supplier1, :receiver => oc.coordinator,
|
||||
:receival_time => 'time 0', :receival_instructions => 'instructions 0')
|
||||
:receival_instructions => 'instructions 0')
|
||||
ex2 = create(:exchange, :order_cycle => oc, :incoming => true,
|
||||
:sender => supplier2, :receiver => oc.coordinator,
|
||||
:receival_time => 'time 1', :receival_instructions => 'instructions 1')
|
||||
:receival_instructions => 'instructions 1')
|
||||
ExchangeFee.create!(exchange: ex1,
|
||||
enterprise_fee: create(:enterprise_fee, enterprise: ex1.sender))
|
||||
ExchangeFee.create!(exchange: ex2,
|
||||
@@ -73,7 +73,7 @@ FactoryGirl.define do
|
||||
|
||||
after(:create) do |oc, proxy|
|
||||
proxy.suppliers.each do |supplier|
|
||||
ex = create(:exchange, :order_cycle => oc, :sender => supplier, :receiver => oc.coordinator, :incoming => true, :receival_time => 'time', :receival_instructions => 'instructions')
|
||||
ex = create(:exchange, :order_cycle => oc, :sender => supplier, :receiver => oc.coordinator, :incoming => true, :receival_instructions => 'instructions')
|
||||
proxy.variants.each { |v| ex.variants << v }
|
||||
end
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ module OpenFoodNetwork
|
||||
coordinator_id = 123
|
||||
supplier_id = 456
|
||||
|
||||
incoming_exchange = {:enterprise_id => supplier_id, :incoming => true, :variants => {'1' => true, '2' => false, '3' => true}, :enterprise_fee_ids => [1, 2], :receival_time => 'receival time', :receival_instructions => 'receival instructions'}
|
||||
incoming_exchange = {:enterprise_id => supplier_id, :incoming => true, :variants => {'1' => true, '2' => false, '3' => true}, :enterprise_fee_ids => [1, 2], :receival_instructions => 'receival instructions'}
|
||||
|
||||
oc = double(:order_cycle, :coordinator_id => coordinator_id, :exchanges => [], :incoming_exchanges => [incoming_exchange], :outgoing_exchanges => [])
|
||||
|
||||
@@ -19,7 +19,7 @@ module OpenFoodNetwork
|
||||
|
||||
applicator.should_receive(:incoming_exchange_variant_ids).with(incoming_exchange).and_return([1, 3])
|
||||
applicator.should_receive(:exchange_exists?).with(supplier_id, coordinator_id, true).and_return(false)
|
||||
applicator.should_receive(:add_exchange).with(supplier_id, coordinator_id, true, {:variant_ids => [1, 3], :enterprise_fee_ids => [1, 2], :receival_time => 'receival time', :receival_instructions => 'receival instructions'})
|
||||
applicator.should_receive(:add_exchange).with(supplier_id, coordinator_id, true, {:variant_ids => [1, 3], :enterprise_fee_ids => [1, 2], :receival_instructions => 'receival instructions'})
|
||||
applicator.should_receive(:destroy_untouched_exchanges)
|
||||
|
||||
applicator.go!
|
||||
@@ -47,7 +47,7 @@ module OpenFoodNetwork
|
||||
coordinator_id = 123
|
||||
supplier_id = 456
|
||||
|
||||
incoming_exchange = {:enterprise_id => supplier_id, :incoming => true, :variants => {'1' => true, '2' => false, '3' => true}, :enterprise_fee_ids => [1, 2], :receival_time => 'receival time', :receival_instructions => 'receival instructions'}
|
||||
incoming_exchange = {:enterprise_id => supplier_id, :incoming => true, :variants => {'1' => true, '2' => false, '3' => true}, :enterprise_fee_ids => [1, 2], :receival_instructions => 'receival instructions'}
|
||||
|
||||
oc = double(:order_cycle,
|
||||
:coordinator_id => coordinator_id,
|
||||
@@ -59,7 +59,7 @@ module OpenFoodNetwork
|
||||
|
||||
applicator.should_receive(:incoming_exchange_variant_ids).with(incoming_exchange).and_return([1, 3])
|
||||
applicator.should_receive(:exchange_exists?).with(supplier_id, coordinator_id, true).and_return(true)
|
||||
applicator.should_receive(:update_exchange).with(supplier_id, coordinator_id, true, {:variant_ids => [1, 3], :enterprise_fee_ids => [1, 2], :receival_time => 'receival time', :receival_instructions => 'receival instructions'})
|
||||
applicator.should_receive(:update_exchange).with(supplier_id, coordinator_id, true, {:variant_ids => [1, 3], :enterprise_fee_ids => [1, 2], :receival_instructions => 'receival instructions'})
|
||||
applicator.should_receive(:destroy_untouched_exchanges)
|
||||
|
||||
applicator.go!
|
||||
|
||||
@@ -11,7 +11,7 @@ describe ProducerMailer do
|
||||
let(:p2) { create(:product, price: 23.45, supplier: s2) }
|
||||
let(:p3) { create(:product, price: 34.56, supplier: s1) }
|
||||
let(:order_cycle) { create(:simple_order_cycle) }
|
||||
let!(:incoming_exchange) { order_cycle.exchanges.create! sender: s1, receiver: d1, incoming: true, receival_time: '10am Saturday', receival_instructions: 'Outside shed.' }
|
||||
let!(:incoming_exchange) { order_cycle.exchanges.create! sender: s1, receiver: d1, incoming: true, receival_instructions: 'Outside shed.' }
|
||||
|
||||
let!(:order) do
|
||||
order = create(:order, distributor: d1, order_cycle: order_cycle, state: 'complete')
|
||||
@@ -43,10 +43,6 @@ describe ProducerMailer do
|
||||
mail.reply_to.should == [s1.email]
|
||||
end
|
||||
|
||||
it "includes receival time" do
|
||||
mail.body.should include '10am Saturday'
|
||||
end
|
||||
|
||||
it "includes receival instructions" do
|
||||
mail.body.should include 'Outside shed.'
|
||||
end
|
||||
|
||||
@@ -277,7 +277,7 @@ describe Exchange do
|
||||
'payment_enterprise_id' => exchange.payment_enterprise_id, 'variant_ids' => exchange.variant_ids.sort,
|
||||
'enterprise_fee_ids' => exchange.enterprise_fee_ids.sort,
|
||||
'pickup_time' => exchange.pickup_time, 'pickup_instructions' => exchange.pickup_instructions,
|
||||
'receival_time' => exchange.receival_time, 'receival_instructions' => exchange.receival_instructions,
|
||||
'receival_instructions' => exchange.receival_instructions,
|
||||
'created_at' => exchange.created_at, 'updated_at' => exchange.updated_at}
|
||||
end
|
||||
|
||||
@@ -288,7 +288,7 @@ describe Exchange do
|
||||
'payment_enterprise_id' => exchange.payment_enterprise_id, 'variant_ids' => exchange.variant_ids.sort,
|
||||
'enterprise_fee_ids' => exchange.enterprise_fee_ids.sort,
|
||||
'pickup_time' => exchange.pickup_time, 'pickup_instructions' => exchange.pickup_instructions,
|
||||
'receival_time' => exchange.receival_time, 'receival_instructions' => exchange.receival_instructions}
|
||||
'receival_instructions' => exchange.receival_instructions}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user