Permalink
Browse files

Fix bug in Erlang code

  • Loading branch information...
Andreas Pauley
Andreas Pauley committed May 19, 2012
1 parent c903240 commit e5315a05f529f3343717d33f4a97ced9014e52cb
Showing with 8 additions and 4 deletions.
  1. +8 −4 erlang/apauley/prices.erl
View
@@ -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)) ->

0 comments on commit e5315a0

Please sign in to comment.