|
|
@ -138,14 +138,12 @@
|
|
|
|
function update_price(commission: Commission) {
|
|
|
|
function update_price(commission: Commission) {
|
|
|
|
commission.price = 0;
|
|
|
|
commission.price = 0;
|
|
|
|
|
|
|
|
|
|
|
|
console.log(commission.answers);
|
|
|
|
|
|
|
|
for (let index = 0; index < commission.answers.length; index++) {
|
|
|
|
for (let index = 0; index < commission.answers.length; index++) {
|
|
|
|
const answer = commission.answers[index];
|
|
|
|
const answer = commission.answers[index];
|
|
|
|
const question = commission.questions.filter(value => {
|
|
|
|
const question = commission.questions.filter(value => {
|
|
|
|
return value['name'] == answer['name'];
|
|
|
|
return value['name'] == answer['name'];
|
|
|
|
})[0];
|
|
|
|
})[0];
|
|
|
|
|
|
|
|
|
|
|
|
console.log(commission.price);
|
|
|
|
|
|
|
|
question['options'].forEach(value => {
|
|
|
|
question['options'].forEach(value => {
|
|
|
|
if(value['name'] == answer['option']) {
|
|
|
|
if(value['name'] == answer['option']) {
|
|
|
|
commission.price += value['price'];
|
|
|
|
commission.price += value['price'];
|
|
|
@ -154,7 +152,6 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
total = 0;
|
|
|
|
total = 0;
|
|
|
|
// console.log(commissions);
|
|
|
|
|
|
|
|
commissions.forEach(value => {
|
|
|
|
commissions.forEach(value => {
|
|
|
|
total += value.price;
|
|
|
|
total += value.price;
|
|
|
|
})
|
|
|
|
})
|
|
|
|