@ninjatronic wrote:
My server returns a list of daily updates and I would like to create a running total from those updates to display on my page. At the moment I have that logic in the model hook on my route…
async model() { return this.store.findAll('update').then(function(results) { let runningTotal = 0; results.sortBy('date').forEach((result, i) => { runningTotal += result.total; result.runningTotal = runningTotal; }); return results; });
This definitely feels like the wrong place to be doing this. I’m returning to Ember after a few years. Way back when I would have done this in a controller but now I can’t figure out a better way to approach this. Can anyone help?
Thanks
Posts: 7
Participants: 2