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

Deal with reality that not all calculable objects have stock_locations. #96

Closed
wants to merge 1 commit into from
Closed

Conversation

rterbush
Copy link
Contributor

Not completely sure this is the right solution. Seems we should not be sending calculables to shipping calculators without a stock_location.

What say you @radar, @LBRapid, @BDQ

This is in response to spree/spree#3381

@@ -28,8 +28,10 @@ def compute(object)
end

if object.is_a?(Spree::Shipment)
return nil unless defined? object.stock_location_id
Copy link
Contributor

Choose a reason for hiding this comment

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

In what case would a shipment not have a stock location?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually not sure why order objects are getting passed around here, but appears that ALL calculable objects hit all compute methods.

As to when a shipment may not have a location, I suspect with digital content, that would be the case. Not my case here.

This is relevant to issues I have raised in the past where it seems we are passing just about anything to these shipment calculators. spree_active_shipping sees, Order objects, Shipment objects and Package objects. Not sure if perhaps an order object is getting passed for every stock location and I am seeing this because not every location has every variant.

I think it deserves more investigation by someone who understands a bit more about what is going on.

Here is a previous comment I offered: #80 (comment)

@radar
Copy link
Contributor

radar commented Jul 16, 2013

Where is this Spree::Shipment being passed in from? Why isn't it a Spree::Stock::Package?

radar added a commit that referenced this pull request Jul 17, 2013
…ock::Package object

Fixes #96

Conflicts:
	app/models/spree/calculator/shipping/active_shipping/base.rb
@radar radar closed this in 00dd7a1 Jul 17, 2013
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.

None yet

2 participants