WIP shopping list

This commit is contained in:
vabene1111
2020-09-01 11:31:29 +02:00
parent bc39b53aad
commit 14c94bf7ab

View File

@@ -116,6 +116,7 @@
this.shopping_list = {
"recipes": [],
"entries": [],
"entries_display": [],
"shared": [],
"created_by": 1
}
@@ -167,10 +168,10 @@
}
}
},
updateMultiplier: function(slr_id) {
updateMultiplier: function (slr_id) {
console.log('searching', slr_id)
let slr = undefined
for (let r of this.shopping_list.recipes){
for (let r of this.shopping_list.recipes) {
console.log(r, r.id)
if (r.id === slr_id) {
console.log('FOUND')
@@ -178,10 +179,23 @@
}
}
for (let e of this.shopping_list.entries){
for (let e of this.shopping_list.entries) {
e.amount = (e.amount * slr.multiplier)
}
},
updateDisplay: function () {
//TODO merge multiple ingredients of same unit
this.shopping_list.entries_display = []
for (let e of this.shopping_list.entries) {
let de = e
de.amount = (e.amount * slr.multiplier)
this.shopping_list.entries_display.push({
})
}
},
searchKeywords: function (query) {
this.keywords_loading = true
this.$http.get("{% url 'api:keyword-list' %}" + '?query=' + query + '&limit=10').then((response) => {