So I am trying to create a computed property that will create a new Array of Objects
My issue is how can I sum the number of values that match a certain value and then push that value into the matching object?
The value I need pushed is count:. I am trying to count the number of objects that match each status value in each workflow object from a separate array called engagements.
I have created a Jsfiddle Click Here
The Array should look like this after being computed
var arr = [
{ workflow_id: 1,
statuses: [
{ status: "Received", count: 3},
{ status: "Review", count: 2},
{ status: "complete", count: 4}
]
},
{ workflow_id: 2,
statuses: [
{ status: "Received", count: 3},
{ status: "Review", count: 1},
{ status: "complete", count: 1}
]
},
{ workflow_id: 3,
statuses: [
{ status: "Received", count: 3},
{ status: "Data Entry", count: 2},
{ status: "complete", count: 1}
]
},
]
any help would be greatly appreciated or a point in a direction that could help me solve this issue! thanks