Created
January 11, 2011 01:24
-
-
Save techwhizbang/773835 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
override def calculate(cartItem: CartItem): DiscountResult = { | |
val saleDao = saleDao.findSale | |
if (shopKeeperSale != None) { | |
if (isThis(cartItem.getProductData) || | |
isThat(cartItem.getProductData)) { | |
new DiscountResult(DiscountType.SOME_TYPE_A, percentageOff) | |
} else { | |
new DiscountResult(DiscountType.SOME_TYPE_B, percentageOff) | |
} | |
} else { | |
new DiscountResult(DiscountType.NONE, 0) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I went ahead and made the points of return, functions themselves, but I still feels there may be a cleaner way.
override def calculate(cartItem: CartItem): DiscountResult = {
val saleDao = saleDao.findSale
}
`