Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont assign distributor address to pickups #1642

Conversation

sauloperez
Copy link
Contributor

@sauloperez sauloperez commented Jun 26, 2017

This is one of the two parts of the Order model that get on the way of the Spree 2.0 upgrade as stated in https://community.openfoodnetwork.org/t/order-model-step7/979. TL;DR; #shipping_method is removed from Order in that version.

So far when saving an order we assign the distributor's address to the orders that are picked up (not delivered) but setting the name and phone number from the billing address.

By inspecting the ceckout's UI as well the as the rails views, this is not shown anywhere, so there's no need to assign it in the first place.

Current behaviour

ofn_master

With this PR

ofn_without_validation

We also had the need to refactor shipping methos by introducing Delivery, Pickup and deliverty?.

While reading the codebase we constantly find ourselves "computing" the actual meaning og require_ship_address in our heads to understand whether we're talking about a delivery or a pickup. This refactor makes the itent behind all this logic a bit more obvious, which makes the spree upgrade a bit easier.

@kirstenalarsen
Copy link
Contributor

kirstenalarsen commented Jun 27, 2017 via email

When the shipping method is of pickup type (also referred as
"collection") we don't show the order's ship address in the UI. There's
no point on setting any ship_address in that case then.
@sauloperez sauloperez force-pushed the dont-assign-distributor-address-to-pickups branch from dbbfbec to 670851d Compare June 27, 2017 07:11
@sauloperez
Copy link
Contributor Author

By looking at the uses of ship_address I can't see any impact in those sections. We seem to always check if the order has a ship address first (which means checking for pickup or delivery).

@myriamboure
Copy link
Contributor

@sauloperez there might be some intereference as well with the issue @ltrls is working on #928, he will put his PR in progress on github today so that you can understand what he has done and see together if there is an impact.

@sauloperez sauloperez force-pushed the dont-assign-distributor-address-to-pickups branch from 8c16928 to c304240 Compare June 27, 2017 11:57
order.should_receive(:ship_address=)
controller.send(:clear_ship_address)
shipping_method = build(:shipping_method)
shipping_method_instance = Pickup.new(order)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, the var is not used besides as return value of the stub

@sauloperez sauloperez force-pushed the dont-assign-distributor-address-to-pickups branch from c304240 to 2f54eb3 Compare June 28, 2017 06:46
@sauloperez
Copy link
Contributor Author

sauloperez commented Jul 4, 2017

@myriamboure there is no interference so far, but athough doesn't look like there will be, since it's still WIP I can't tell for sure.

@sauloperez
Copy link
Contributor Author

sauloperez commented Jul 7, 2017

We'll address the problems shipping_address_from_distributor brings to the Spree upgrade with a smaller change since this didn't inspire much confidence.

Part of the refactor introduced here is now in #1669.

@sauloperez sauloperez closed this Jul 7, 2017
@enricostano enricostano deleted the dont-assign-distributor-address-to-pickups branch July 10, 2017 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants