diff --git a/cookbook/serializer.py b/cookbook/serializer.py index 6fa63f94..8a5212cd 100644 --- a/cookbook/serializer.py +++ b/cookbook/serializer.py @@ -692,7 +692,8 @@ class ShoppingListRecipeSerializer(serializers.ModelSerializer): ) + f' ({value:.2g})' def update(self, instance, validated_data): - if 'servings' in validated_data: + # TODO remove once old shopping list + if 'servings' in validated_data and self.context.get('view', None).__class__.__name__ != 'ShoppingListViewSet': list_from_recipe( list_recipe=instance, servings=validated_data['servings'], diff --git a/cookbook/signals.py b/cookbook/signals.py index d763b897..b4a52874 100644 --- a/cookbook/signals.py +++ b/cookbook/signals.py @@ -121,11 +121,3 @@ def auto_add_shopping(sender, instance=None, created=False, weak=False, **kwargs 'servings': instance.servings } list_recipe = list_from_recipe(**kwargs) - - -# user = self.context['request'].user -# if user.userpreference.shopping_add_onhand: -# if checked := validated_data.get('checked', None): -# instance.food.onhand_users.add(*user.userpreference.shopping_share.all(), user) -# elif checked == False: -# instance.food.onhand_users.remove(*user.userpreference.shopping_share.all(), user) diff --git a/cookbook/templates/shopping_list.html b/cookbook/templates/shopping_list.html index cfb2cb7f..2720d589 100644 --- a/cookbook/templates/shopping_list.html +++ b/cookbook/templates/shopping_list.html @@ -834,7 +834,7 @@ this.$http.get('{% url 'api:recipe-detail' 123456 %}'.replace('123456', recipe.id)).then((response) => { for (let s of response.data.steps) { for (let i of s.ingredients) { - if (!i.is_header && i.food !== null && i.food.food_onhand === false) { + if (!i.is_header && i.food !== null && !i.food.ignore_food) { this.shopping_list.entries.push({ 'list_recipe': slr.id, 'food': i.food, diff --git a/vue/src/apps/ShoppingListView/ShoppingListView.vue b/vue/src/apps/ShoppingListView/ShoppingListView.vue index 537dde0d..a9137619 100644 --- a/vue/src/apps/ShoppingListView/ShoppingListView.vue +++ b/vue/src/apps/ShoppingListView/ShoppingListView.vue @@ -1096,6 +1096,7 @@ export default { if (!autosync) { if (results.data?.length) { this.items = results.data + console.log(this.items) } else { console.log("no data returned") }