function buildTableArray (source, response, total, prop) {
      var counts;

      counts = _.map(_.cloneDeep(source), function (o) {
        o.name = o.title;

        if (o.type === 'activityGroup') {
          o.count = 0;
        } else {
          o.count = _.isNumber(response[o.id]) ? response[o.id] : 0;
        }

        return o;
      });

      // Calculate counts for children
      return _.map(counts, function (o, index, coll) {
        o.count = calcCount(o, coll, prop);
        o.percent = calcPct(o.count, total);
        return o;
      });
    }
// Build array for locations/activities table
Build array for locations/activities table
Build array for locations / activities table
function buildTableArray (source, response, total, prop) {
      var counts;
      counts = _.map(_.cloneDeep(source), function (o) {
        o.name = o.title;
        if (o.type === 'activityGroup') {
          o.count = 0;
        } else {
          o.count = _.isNumber(response[o.id]) ? response[o.id] : 0;
        }
        return o;
      });
      return _.map(counts, function (o, index, coll) {
        o.count = calcCount(o, coll, prop);
        o.percent = calcPct(o.count, total);
        return o;
      });
    }
function buildTableArray ( source , response , total , prop ) { var counts ; counts = _ . map ( _ . cloneDeep ( source ) , function ( o ) { o . name = o . title ; if ( o . type === 'activityGroup' ) { o . count = 0 ; } else { o . count = _ . isNumber ( response [ o . id ] ) ? response [ o . id ] : 0 ; } return o ; } ) ; return _ . map ( counts , function ( o , index , coll ) { o . count = calcCount ( o , coll , prop ) ; o . percent = calcPct ( o . count , total ) ; return o ; } ) ; }
Build array for locations/activities table
Build array for locations / activities table
// Calculate counts for children