Currently, I'm in the process of creating a computed property that will generate a fresh Array of Objects
The challenge I am facing is figuring out how to sum up the number of values that match a specific value and then insert that value into the corresponding object?
The specific value I want to add is count:
. My goal is to count the number of objects that correspond to each status value in every workflow object from a separate array named engagements
.
In order to showcase what the Array should look like after the computation, take a look below:
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}
]
},
]
If anyone has any suggestions or can guide me towards a solution for this problem, it would be greatly appreciated! Thanks!