This the result of my query I want to get the total of
deduction
3: {total_ot: 0, total_days: 96, total_allowance: 0, wrk_id: 3, f_name: "JOHN", l_name: "DOE",…}
daily_rate: 560
date: {2020-09-24: {work_hours: 8, adj_hour: 0}, 2020-09-25: {work_hours: 8, adj_hour: 0},…}
deduction: {1: {amount: 700}, 2: {amount: 700}}
f_name: "JOHN"
l_name: "DOE"
m_name: null
total_allowance: 0
total_days: 96
total_ot: 0
wrk_id: 3
In my computed
deducted(){ const deducted = Object.values(this.workersSummaryData) return deducted.reduce((acc, item) =>{ console.log(item.deducted) if(item.deduction) return acc + item.deduction; else return acc }, 0) } },
result of my query- could you post that in a form that looks like it's in a javascript variable? at the moment, it just looks like something that wouldn't be in javascriptreturn acc + item.deduction.amountreturn acc + Object.values(item.deduction).map(({amount}) => amount).reduce((a, b) => a+b)- sincedeductionis an object with properties that are objects with a property called amount :p3200, Instead of1400