I'm trying to this computed property to work by selecting individual scores of a movie, and finding the average. It's been a bit tricky, but this is what I have so far...
testing: Ember.computed('movie.title', 'movie.rating', function() {
return this.get('movie.title') + ', ' + this.get('movie.rating');
}),
averageScore: Ember.computed('review.@each.score', function() { //Used to determite each score of review
return this.get('review').(function(sum, review) {
return sum += review.get('score');
}, 0) / this.get('reviews').get('length');
}),
I know I'm missing something, any suggestions?
Aucun commentaire:
Enregistrer un commentaire