Oprava generování QR kódů pro Pizza day
This commit is contained in:
@@ -319,13 +319,13 @@ export async function finishPizzaDelivery(login: string, bankAccount?: string, b
|
||||
clientData.pizzaDay.state = PizzaDayState.DELIVERED;
|
||||
|
||||
// Vygenerujeme QR kód, pokud k tomu máme data
|
||||
// TODO berka je potřeba počkat na resolve promises z generateQr a až poté volat save do DB
|
||||
if (bankAccount?.length && bankAccountHolder?.length) {
|
||||
for (const order of clientData.pizzaDay.orders) {
|
||||
if (order.customer !== login) { // zatím platí creator = objednávající, a pro toho nemá QR kód smysl
|
||||
let message = order.pizzaList.map(pizza => `Pizza ${pizza.name} (${pizza.size})`).join(', ');
|
||||
const price = order.pizzaList.map(pizza => pizza.price).reduce((partial, a) => partial + a, 0);
|
||||
generateQr(order.customer, bankAccount, bankAccountHolder, price, message).then(() => order.hasQr = true);
|
||||
await generateQr(order.customer, bankAccount, bankAccountHolder, price, message);
|
||||
order.hasQr = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user