mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-03 13:19:16 -05:00
fixed saving null units
This commit is contained in:
@@ -109,23 +109,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table class="table table-sm table-striped">
|
<table class="table table-sm table-striped" style="margin-top: 1vh">
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>#</th>
|
|
||||||
<th>1</th>
|
|
||||||
<th>2</th>
|
|
||||||
<th>3</th>
|
|
||||||
<th></th>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody is="draggable" group="people" :list="display_entries" tag="tbody" :empty-insert-threshold="10"
|
<tbody is="draggable" group="people" :list="display_entries" tag="tbody" :empty-insert-threshold="10"
|
||||||
handle=".handle" @sort="sortEntries()">
|
handle=".handle" @sort="sortEntries()">
|
||||||
|
|
||||||
<tr v-for="(element, index) in display_entries" :key="element.id">
|
<tr v-for="(element, index) in display_entries" :key="element.id">
|
||||||
<td class="handle"><i class="fas fa-sort"></i></td>
|
<!--<td class="handle"><i class="fas fa-sort"></i></td>-->
|
||||||
<td>[[element.amount]]</td>
|
<td>[[element.amount]]</td>
|
||||||
<td>[[element.unit.name]]</td>
|
<td>[[element.unit.name]]</td>
|
||||||
<td>[[element.food.name]]</td>
|
<td>[[element.food.name]]</td>
|
||||||
@@ -344,6 +334,7 @@
|
|||||||
if (item.list_recipe !== null) {
|
if (item.list_recipe !== null) {
|
||||||
item.amount = item.amount * this.multiplier_cache[item.list_recipe]
|
item.amount = item.amount * this.multiplier_cache[item.list_recipe]
|
||||||
}
|
}
|
||||||
|
item.unit = ((element.unit !== undefined && element.unit !== null) ? element.unit : {'name': ''})
|
||||||
entries.push(item)
|
entries.push(item)
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -539,7 +530,7 @@
|
|||||||
this.shopping_list.entries.push({
|
this.shopping_list.entries.push({
|
||||||
'list_recipe': null,
|
'list_recipe': null,
|
||||||
'food': this.new_entry.food,
|
'food': this.new_entry.food,
|
||||||
'unit': ((this.new_entry.unit !== undefined) ? this.new_entry.unit : {'name': ''}),
|
'unit': this.new_entry.unit,
|
||||||
'amount': parseFloat(this.new_entry.amount),
|
'amount': parseFloat(this.new_entry.amount),
|
||||||
'order': 0,
|
'order': 0,
|
||||||
'checked': false
|
'checked': false
|
||||||
@@ -592,7 +583,7 @@
|
|||||||
this.shopping_list.entries.push({
|
this.shopping_list.entries.push({
|
||||||
'list_recipe': slr.id,
|
'list_recipe': slr.id,
|
||||||
'food': i.food,
|
'food': i.food,
|
||||||
'unit': ((i.unit !== undefined && i.unit !== null) ? i.unit : {'name': ''}),
|
'unit': i.unit,
|
||||||
'amount': i.amount,
|
'amount': i.amount,
|
||||||
'order': 0
|
'order': 0
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user