Skip to content

Commit d233eba

Browse files
committed
fix!: individual quantities of referenced ingredient are not preserved
BREAKING CHANGE: the `partialQuantity` and `partialUnit` properties of ingredients items in preparation steps are renamed respectively `itemQuantity` and `itemUnit`. Moreover, the `partialPreparation` is removed as the preparation is fixed for a given ingredient in the list.
1 parent 5fc1b80 commit d233eba

File tree

4 files changed

+238
-17
lines changed

4 files changed

+238
-17
lines changed

src/classes/recipe.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,9 @@ export class Recipe {
183183
const newItem: IngredientItem = {
184184
type: "ingredient",
185185
value: idxInList,
186+
itemQuantity: quantity,
187+
itemUnit: units,
186188
};
187-
if (reference) {
188-
newItem.partialQuantity = quantity;
189-
newItem.partialUnit = units;
190-
newItem.partialPreparation = preparation;
191-
}
192189

193190
items.push(newItem);
194191
} else if (groups.mCookwareName || groups.sCookwareName) {

src/types.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,10 @@ export interface IngredientItem {
189189
type: "ingredient";
190190
/** The value of the item. */
191191
value: number;
192-
/** If this is a referenced ingredient, quantity specific to this instance */
193-
partialQuantity?: FixedValue | Range;
194-
/** If this is a referenced ingredient, unit specific to this instance */
195-
partialUnit?: string;
196-
/** If this is a referenced ingredient, preparation specific to this instance */
197-
partialPreparation?: string;
192+
/** Quantity specific to this step item for this ingredient which may also be referenced elsewhere */
193+
itemQuantity?: FixedValue | Range;
194+
/** Unit specific to this step item for this ingredient which may also be referenced elsewhere */
195+
itemUnit?: string;
198196
}
199197

200198
/**

0 commit comments

Comments
 (0)