discourse/app/assets/javascripts/admin/helpers/report_helpers.js

17 lines
433 B
JavaScript

/**
Return the count of users at the given trust level.
@method valueAtTrustLevel
@for Handlebars
**/
Handlebars.registerHelper('valueAtTrustLevel', function(property, trustLevel) {
var data = Ember.Handlebars.get(this, property);
if( data ) {
var item = data.find( function(d) { return parseInt(d.x,10) === parseInt(trustLevel,10); } );
if( item ) {
return item.y;
} else {
return 0;
}
}
});