mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 04:12:59 +00:00
Finish first version of nested recipes feature (references #77)
This commit is contained in:
@@ -23,3 +23,18 @@ AS (
|
||||
)
|
||||
SELECT *
|
||||
FROM r1;
|
||||
|
||||
DROP VIEW recipes_fulfillment_sum;
|
||||
CREATE VIEW recipes_fulfillment_sum
|
||||
AS
|
||||
SELECT
|
||||
r.id AS recipe_id,
|
||||
IFNULL(MIN(rf.need_fulfilled), 1) AS need_fulfilled,
|
||||
IFNULL(MIN(rf.need_fulfilled_with_shopping_list), 1) AS need_fulfilled_with_shopping_list,
|
||||
(SELECT COUNT(*) FROM recipes_fulfillment WHERE recipe_id IN (SELECT includes_recipe_id FROM recipes_nestings_resolved rnr2 WHERE rnr2.recipe_id = r.id) AND need_fulfilled = 0 AND recipe_pos_id IS NOT NULL) AS missing_products_count
|
||||
FROM recipes r
|
||||
LEFT JOIN recipes_nestings_resolved rnr
|
||||
ON r.id = rnr.recipe_id
|
||||
LEFT JOIN recipes_fulfillment rf
|
||||
ON rnr.includes_recipe_id = rf.recipe_id
|
||||
GROUP BY r.id;
|
||||
|
Reference in New Issue
Block a user