I've already read some topics here in stackoverflow, but I didn't found a solution to my problem... I want do the sum of 'progress' field in all my models into a collection... So in my collection file I have:
progressTotal: ->
total = _.reduce(@, ((memo, value) ->
memo + value.get('progress')
), 0)
return total
But I get that value is undefined ... why ? I've taken inspiration from here: Getting the sum of a collection (all models) with backbone.js but the solution doesn't work for me.
Any suggestion ? thank you
EDIT: Seems like if progress is a string...but in my db is a integer.