fixed saving null units

This commit is contained in:
vabene1111
2020-10-15 21:37:15 +02:00
parent 526cf13b8d
commit 5c1cecb7e7

View File

@@ -109,23 +109,13 @@
</div>
</div>
<table class="table table-sm table-striped">
<thead>
<tr>
<th>#</th>
<th>1</th>
<th>2</th>
<th>3</th>
<th></th>
</tr>
</thead>
<table class="table table-sm table-striped" style="margin-top: 1vh">
<tbody is="draggable" group="people" :list="display_entries" tag="tbody" :empty-insert-threshold="10"
handle=".handle" @sort="sortEntries()">
<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.unit.name]]</td>
<td>[[element.food.name]]</td>
@@ -344,6 +334,7 @@
if (item.list_recipe !== null) {
item.amount = item.amount * this.multiplier_cache[item.list_recipe]
}
item.unit = ((element.unit !== undefined && element.unit !== null) ? element.unit : {'name': ''})
entries.push(item)
});
@@ -539,7 +530,7 @@
this.shopping_list.entries.push({
'list_recipe': null,
'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),
'order': 0,
'checked': false
@@ -592,7 +583,7 @@
this.shopping_list.entries.push({
'list_recipe': slr.id,
'food': i.food,
'unit': ((i.unit !== undefined && i.unit !== null) ? i.unit : {'name': ''}),
'unit': i.unit,
'amount': i.amount,
'order': 0
})