Skip to content

Commit

Permalink
Fix bug in Erlang code
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Pauley committed May 19, 2012
1 parent c903240 commit e5315a0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions erlang/apauley/prices.erl
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,19 @@ supplier_markup_percentage_modification(SupplierID) ->
false -> 0
end.

shelf_days(_SupplierID=32, ProductType) ->
shelf_days(ProductType) - 3;
shelf_days(_SupplierID, ProductType) ->
shelf_days(ProductType).
shelf_days(SupplierID, ProductType) ->
shelf_days(ProductType) + shelf_days_modifier(SupplierID).

shelf_days(apple) -> 14;
shelf_days(banana) -> 5;
shelf_days(_ProductType) -> 7.

shelf_days_modifier(SupplierID) ->
case lists:member(SupplierID, ?UNFRESH_SUPPLIER_IDS) of
true -> -3;
false -> 0
end.

product_type(ProductCode) when ((ProductCode >= 1100) and (ProductCode =< 1199)) ->
apple;
product_type(ProductCode) when ((ProductCode >= 1200) and (ProductCode =< 1299)) ->
Expand Down

0 comments on commit e5315a0

Please sign in to comment.