I'm already using an Array.map, but with the same data, I need to do some other calculations. Should I do those calculations within the map or do it in a for each after the map?
return res.data.map(function (obj) {
if(obj.status.id == 6 || obj.status.id == 5){
dateDifference(obj.created_at,obj.closed_at);
}else{
$scope.open++;
}
return {
"id":obj.id,
"subject": obj.subject,
"requester": obj.requester.name,
"assigned": obj.assigned ? obj.assigned.name : '',
"priority": obj.priority.name,
"status": obj.status.name,
"category": obj.category.name,
"created_at": moment(obj.created_at).utcOffset("06:00").format('lll'),
"updated_at": moment(obj.updated_at).utcOffset("06:00").format('lll')
}
})