Entfernen der User aus den FreeDrinkLists
This commit is contained in:
parent
61dd94c523
commit
10eccba914
|
@ -46,10 +46,6 @@ name: "FreeDrinkListBand",
|
||||||
text: 'Anzahl',
|
text: 'Anzahl',
|
||||||
value: 'count'
|
value: 'count'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
text: 'User',
|
|
||||||
value: 'user'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
text: 'Preis pro Getränk',
|
text: 'Preis pro Getränk',
|
||||||
value: 'pricepro'
|
value: 'pricepro'
|
||||||
|
@ -87,29 +83,16 @@ name: "FreeDrinkListBand",
|
||||||
let history_of_config = history_of_date.filter(item => {
|
let history_of_config = history_of_date.filter(item => {
|
||||||
return item.free_drink_config_id == drink_config.id
|
return item.free_drink_config_id == drink_config.id
|
||||||
})
|
})
|
||||||
// eslint-disable-next-line no-unused-vars
|
if (history_of_config.length > 0) {
|
||||||
let users = []
|
|
||||||
history_of_config.forEach(history_config => {
|
|
||||||
if (!users.find(user_id => { return user_id == history_config.user_id})) {
|
|
||||||
users.push(history_config.user_id)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
users.forEach(user_id => {
|
|
||||||
let history_of_user = history_of_config.filter(item => {
|
|
||||||
return item.user_id == user_id
|
|
||||||
})
|
|
||||||
if (history_of_user.length > 0) {
|
|
||||||
retVal.push({
|
retVal.push({
|
||||||
date: `${from.getDate()}.${from.getMonth() + 1}.${from.getFullYear()}`,
|
date: `${from.getDate()}.${from.getMonth() + 1}.${from.getFullYear()}`,
|
||||||
label: drink_config.label,
|
label: drink_config.label,
|
||||||
name: drink_config.drink.name,
|
name: drink_config.drink.name,
|
||||||
user: `${history_of_user[0].user.firstname} ${history_of_user[0].user.lastname}`,
|
count: history_of_config.length,
|
||||||
count: history_of_user.length,
|
|
||||||
pricepro: (drink_config.price / 100).toFixed(2),
|
pricepro: (drink_config.price / 100).toFixed(2),
|
||||||
sum: (drink_config.price / 100 * history_of_user.length).toFixed(2)
|
sum: (drink_config.price / 100 * history_of_config.length).toFixed(2)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return retVal
|
return retVal
|
||||||
|
|
|
@ -46,10 +46,6 @@ data() {
|
||||||
text: 'Anzahl',
|
text: 'Anzahl',
|
||||||
value: 'count'
|
value: 'count'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
text: 'User',
|
|
||||||
value: 'user'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
text: 'Preis pro Getränk',
|
text: 'Preis pro Getränk',
|
||||||
value: 'pricepro'
|
value: 'pricepro'
|
||||||
|
@ -87,29 +83,16 @@ computed: {
|
||||||
let history_of_config = history_of_date.filter(item => {
|
let history_of_config = history_of_date.filter(item => {
|
||||||
return item.free_drink_config_id == drink_config.id
|
return item.free_drink_config_id == drink_config.id
|
||||||
})
|
})
|
||||||
// eslint-disable-next-line no-unused-vars
|
if (history_of_config.length > 0) {
|
||||||
let users = []
|
|
||||||
history_of_config.forEach(history_config => {
|
|
||||||
if (!users.find(user_id => { return user_id == history_config.user_id})) {
|
|
||||||
users.push(history_config.user_id)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
users.forEach(user_id => {
|
|
||||||
let history_of_user = history_of_config.filter(item => {
|
|
||||||
return item.user_id == user_id
|
|
||||||
})
|
|
||||||
if (history_of_user.length > 0) {
|
|
||||||
retVal.push({
|
retVal.push({
|
||||||
date: `${from.getDate()}.${from.getMonth() + 1}.${from.getFullYear()}`,
|
date: `${from.getDate()}.${from.getMonth() + 1}.${from.getFullYear()}`,
|
||||||
label: drink_config.label,
|
label: drink_config.label,
|
||||||
name: drink_config.drink.name,
|
name: drink_config.drink.name,
|
||||||
user: `${history_of_user[0].user.firstname} ${history_of_user[0].user.lastname}`,
|
count: history_of_config.length,
|
||||||
count: history_of_user.length,
|
|
||||||
pricepro: (drink_config.price / 100).toFixed(2),
|
pricepro: (drink_config.price / 100).toFixed(2),
|
||||||
sum: (drink_config.price / 100 * history_of_user.length).toFixed(2)
|
sum: (drink_config.price / 100 * history_of_config.length).toFixed(2)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return retVal
|
return retVal
|
||||||
|
|
Loading…
Reference in New Issue