corrected servings factor
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<component :is="compiled" :servings="servings" :code="code"></component>
|
||||
<component :is="compiled" :ingredient_factor="ingredient_factor" :code="code"></component>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -18,7 +18,7 @@ obviously only run trusted code this way ...
|
||||
|
||||
export default {
|
||||
name: 'CompileComponent',
|
||||
props: ['code', 'servings'],
|
||||
props: ['code', 'ingredient_factor'],
|
||||
data() {
|
||||
return {
|
||||
compiled: null,
|
||||
@ -26,7 +26,7 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.compiled = Vue.component('compiled-component', {
|
||||
props: ['servings', 'code'],
|
||||
props: ['ingredient_factor', 'code'],
|
||||
components: {
|
||||
ScalableNumber, // eslint-disable-line
|
||||
},
|
||||
|
@ -35,7 +35,7 @@ export default {
|
||||
name: 'Ingredient',
|
||||
props: {
|
||||
ingredient: Object,
|
||||
servings: {
|
||||
ingredient_factor: {
|
||||
type: Number,
|
||||
default: 1,
|
||||
}
|
||||
@ -47,7 +47,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
calculateAmount: function (x) {
|
||||
return calculateAmount(x, this.servings)
|
||||
return calculateAmount(x, this.ingredient_factor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,11 +65,11 @@ export default {
|
||||
],
|
||||
props: {
|
||||
recipe: Object,
|
||||
servings: Number,
|
||||
ingredient_factor: Number,
|
||||
},
|
||||
methods: {
|
||||
calculateAmount: function (x) {
|
||||
return calculateAmount(x, this.servings)
|
||||
return calculateAmount(x, this.ingredient_factor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,13 +34,13 @@
|
||||
<table class="table table-sm">
|
||||
<!-- eslint-disable vue/no-v-for-template-key-on-child -->
|
||||
<template v-for="i in step.ingredients">
|
||||
<Ingredient v-bind:ingredient="i" v-bind:servings="servings" :key="i.id" @checked-state-changed="$emit('checked-state-changed', i)"></Ingredient>
|
||||
<Ingredient v-bind:ingredient="i" :ingredient_factor="ingredient_factor" :key="i.id" @checked-state-changed="$emit('checked-state-changed', i)"></Ingredient>
|
||||
</template>
|
||||
<!-- eslint-enable vue/no-v-for-template-key-on-child -->
|
||||
</table>
|
||||
</div>
|
||||
<div class="col" :class="{ 'col-md-8': recipe.steps.length > 1, 'col-md-12': recipe.steps.length <= 1,}">
|
||||
<compile-component :code="step.ingredients_markdown" :servings="servings"></compile-component>
|
||||
<compile-component :code="step.ingredients_markdown" :ingredient_factor="ingredient_factor"></compile-component>
|
||||
</div>
|
||||
</div>
|
||||
</b-collapse>
|
||||
@ -71,7 +71,7 @@
|
||||
<b-collapse id="collapse-1" v-model="details_visible">
|
||||
<div class="row" v-if="step.instruction !== ''">
|
||||
<div class="col col-md-12" style="text-align: center">
|
||||
<compile-component :code="step.ingredients_markdown" :servings="servings"></compile-component>
|
||||
<compile-component :code="step.ingredients_markdown" :ingredient_factor="ingredient_factor"></compile-component>
|
||||
</div>
|
||||
</div>
|
||||
</b-collapse>
|
||||
@ -134,7 +134,7 @@ export default {
|
||||
},
|
||||
props: {
|
||||
step: Object,
|
||||
servings: Number,
|
||||
ingredient_factor: Number,
|
||||
index: Number,
|
||||
recipe: Object,
|
||||
start_time: String,
|
||||
@ -151,7 +151,7 @@ export default {
|
||||
methods: {
|
||||
calculateAmount: function (x) {
|
||||
// used by the jinja2 template
|
||||
return calculateAmount(x, this.servings)
|
||||
return calculateAmount(x, this.ingredient_factor)
|
||||
},
|
||||
updateTime: function () {
|
||||
this.$emit('update-start-time', moment(this.set_time_input).add(this.time_offset * -1, 'minutes').format('yyyy-MM-DDTHH:mm'))
|
||||
|
Reference in New Issue
Block a user