Use correct serving count from recipe view -> add to shopping

This commit is contained in:
tourn 2020-12-24 11:28:59 +01:00
parent 113e9ef1e3
commit aa57b47d18

View File

@ -39,7 +39,7 @@
<button class="dropdown-item" onclick="$('#bookmarkModal').modal({'show':true})">
<i class="fas fa-bookmark fa-fw"></i> {% trans 'Add to Book' %}</button>
<a class="dropdown-item" v-bind:href="getShoppingUrl()" v-if="has_ingredients">
<a class="dropdown-item" v-bind:href="shopping_url" v-if="has_ingredients">
<i class="fas fa-shopping-cart fa-fw"></i> {% trans 'Add to Shopping' %}</a>
<a class="dropdown-item" href="{% url 'new_meal_plan' %}?recipe={{ recipe.pk }}"><i
@ -530,7 +530,10 @@
computed: {
ingredient_factor: function () {
return this.servings / recipe_servings
}
},
shopping_url: function () {
return `{% url 'view_shopping' %}?r=[${this.recipe.id},${this.servings}]`
},
},
mounted: function () {
this.loadRecipe()
@ -583,9 +586,6 @@
}
},
getShoppingUrl: function () {
return `{% url 'view_shopping' %}?r=[${this.recipe.id},${this.ingredient_factor}]`
},
calculateAmount: function (amount) {
{% if request.user.userpreference.use_fractions %}
let return_string = ''