-
-
Notifications
You must be signed in to change notification settings - Fork 708
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug on calculator_decorator line_items_for where input is line_it…
…em with an nil order. Adapted line_items_for so that weight_calculator.line_items_for could be removed.
- Loading branch information
1 parent
0829786
commit b0d1843
Showing
7 changed files
with
21 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
module Spree | ||
Calculator.class_eval do | ||
|
||
|
||
private | ||
|
||
# Given an object which might be an Order or a LineItem (amongst | ||
# others), return a collection of line items. | ||
def line_items_for(object) | ||
if object.respond_to? :line_items | ||
if object.is_a?(Spree::LineItem) | ||
[object] | ||
elsif object.respond_to? :line_items | ||
object.line_items | ||
elsif object.order.present? | ||
object.order.line_items | ||
else | ||
[object] | ||
end | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
require 'spec_helper' | ||
require 'open_food_network/enterprise_fee_calculator' | ||
|
||
module OpenFoodNetwork | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters