Skip to content

Instantly share code, notes, and snippets.

@spolu
Created October 8, 2013 12:44
Show Gist options
  • Save spolu/6884112 to your computer and use it in GitHub Desktop.
Save spolu/6884112 to your computer and use it in GitHub Desktop.
Count Just One Insight
(function($, cb_) {
var r = {
pay: 0,
insights: 0,
only_one: 0,
total: 0
}
$.forEach(function(u) {
if(u['Payer ID'].length > 0 && u['Payer ID'].toLowerCase() !== 'free') {
r.pay++;
if(u['Insights'].length > 0) {
r.insights++;
if(u['Insights'].split('/').length === 1)
r.only_one++;
}
}
r.total++;
});
return cb_(r);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment