Created
August 30, 2021 00:33
-
-
Save acidjazz/8bdb4bd707368d643b494853acf119d2 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
static priceFromCartChoices (rst: Rst, menuId: number, cartChoices: CartChoices, quantity: number) { | |
const options = this.choicesCombined(rst, menuId).map(c => c.options).flat() as Options | |
const ids = cartChoices.map(c => c.options).flat() | |
const selects = options.filter(o => ids.includes(o.id) && o.price) as OptionsWithPrices | |
const extras = selects.reduce((a, b) => a + b.price, 0) | |
return (this.menuFromId(rst, menuId).price + extras) * quantity | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment