Přechody mezi stavy Pizza Day

This commit is contained in:
2023-06-09 20:58:37 +02:00
parent d5d0b88d3c
commit dfce063de7
8 changed files with 249 additions and 20 deletions

View File

@@ -5,6 +5,7 @@ import fs from 'fs';
import axios from 'axios';
type PizzaSize = {
varId: number,
size: string,
pizzaPrice: number,
boxPrice: number,
@@ -67,9 +68,10 @@ const downloadPizzy = async () => {
const sizes: PizzaSize[] = [];
const a = $('.varianty > li > a', pizzaHtml);
a.each((i, elm) => {
const varId = Number.parseInt(elm.attribs.href.split('?varianta=')[1].trim());
const size = $($(elm).contents().get(0)).text().trim();
const price = Number.parseInt($($(elm).contents().get(1)).text().trim().split(" Kč")[0]);
sizes.push({ size: size, pizzaPrice: price, boxPrice: boxPrices[size], price: price + boxPrices[size] });
sizes.push({ varId, size, pizzaPrice: price, boxPrice: boxPrices[size], price: price + boxPrices[size] });
})
result.push({
name: name,