pizzas: 2
This commit is contained in:
parent
432e75526f
commit
c4c52809d2
@ -50,7 +50,7 @@ CREATE TABLE IF NOT EXISTS Pizzas (
|
||||
id INTEGER PRIMARY KEY,
|
||||
name VARCHAR(256),
|
||||
price INTEGER,
|
||||
is_allowed BOOLEAN
|
||||
is_allowed BOOLEAN DEFAULT true
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS PizzasIngredientsJoin (
|
||||
@ -84,12 +84,11 @@ GROUP BY Ingredients.id;
|
||||
|
||||
DROP VIEW IF EXISTS SalesIngredientsCount;
|
||||
CREATE VIEW IF NOT EXISTS SalesIngredientsCount (id, name, count) AS
|
||||
SELECT Ingredients.id AS id, Ingredients.name AS name, sum(Ingredients.weight) as count
|
||||
SELECT Ingredients.id AS id, Ingredients.name AS name, -sum(Ingredients.weight) as count
|
||||
FROM Sales
|
||||
JOIN Pizzas on Pizzas.id = Sales.pizza_id
|
||||
JOIN PizzasIngredientsJoin on PizzasIngredientsJoin.pizza_id = Sales.pizza_id
|
||||
JOIN Ingredients on Ingredients.id = PizzasIngredientsJoin.ingredient_id
|
||||
GROUP BY Ingredients.id;
|
||||
JOIN Ingredients on Ingredients.id = PizzasIngredientsJoin.ingredient_id;
|
||||
|
||||
|
||||
DROP VIEW IF EXISTS IngredientsLeft;
|
||||
@ -281,6 +280,9 @@ join IdBuffer on IdBuffer.id = Ingredients.id
|
||||
console.log(las_id.lastInsertId);
|
||||
|
||||
const query = `insert into PizzasIngredientsJoin (pizza_id, ingredient_id) values
|
||||
<Field name={"разрешено"}>
|
||||
<Boolean bind:value={current_item.is_allowed}></Boolean>
|
||||
</Field>
|
||||
${current_item.ingredients_ids.map((el) => "(" + las_id.lastInsertId + "," + el + ")").join(",")}
|
||||
`;
|
||||
console.log(query);
|
||||
@ -635,4 +637,9 @@ ${current_item.ingredients_ids.map((el) => "(" + current_item.id + "," + el + ")
|
||||
></ViewTable>
|
||||
{/if}
|
||||
{/if}
|
||||
is_allowed: true,
|
||||
<Field name={"разрешено"}>
|
||||
<Boolean bind:value={current_item.is_allowed}></Boolean>
|
||||
</Field>
|
||||
is_allowed: true,
|
||||
</ScreenWrap>
|
||||
|
Loading…
x
Reference in New Issue
Block a user