Skip to content

Commit

Permalink
replace base price calculation by its new variable
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiosilveira committed Aug 20, 2022
1 parent 7428c73 commit b36df25
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions function.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ function price(order) {
// price is base price - quantity discount + shipping
const basePrice = order.quantity * order.itemPrice;
return (
order.quantity * order.itemPrice -
basePrice -
Math.max(0, order.quantity - 500) * order.itemPrice * 0.05 +
Math.min(order.quantity * order.itemPrice * 0.1, 100)
Math.min(basePrice * 0.1, 100)
);
}

Expand Down

0 comments on commit b36df25

Please sign in to comment.