Add ingredients' products
Some checks failed
Build and Deploy / build-and-push (push) Failing after 1m20s
Some checks failed
Build and Deploy / build-and-push (push) Failing after 1m20s
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { INGREDIENTS, RECIPES } from '../data/catalog.js?v=2';
|
||||
import { INGREDIENTS, RECIPES, PRODUCTS } from '../data/catalog.js?v=6';
|
||||
import { MEAL_SLOTS } from '../planner/mealSlots.js';
|
||||
import { PLANS_STORAGE_KEY } from '../storageKeys.js';
|
||||
import { startOfDay } from './dateUtils.js';
|
||||
@@ -40,6 +40,13 @@ function normalizeEntryExtras(x) {
|
||||
.map((a) => ({ ingredientId: a.ingredientId, amount: a.amount, unit: a.unit }));
|
||||
if (valid.length > 0) out.addedIngredients = valid;
|
||||
}
|
||||
if (x.productSelections && typeof x.productSelections === 'object' && !Array.isArray(x.productSelections)) {
|
||||
const ps = {};
|
||||
for (const [k, v] of Object.entries(x.productSelections)) {
|
||||
if (typeof v === 'string' && PRODUCTS[v]) ps[k] = v;
|
||||
}
|
||||
if (Object.keys(ps).length > 0) out.productSelections = ps;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user