Having trouble getting my push function to work properly..
Here is my code snippet:
var result = {};
dpd.timesheetsdone.get(function (timesheets, err) {
if(err) return console.log(err);
timesheets.forEach(function(entry, index) {
result[entry.timesheets[0].week] = [];
result[entry.timesheets[0].week].push(entry);
//here is where I'm trying to push
}
);
setResult(result);
});
When the code runs, it doesn't actually push the entry, it just assigns it and sets result to one item. It's not pushing as intended.
What could be causing this issue?
An example of the timesheets can be found here.