Created
May 28, 2020 08:41
-
-
Save iaindooley/dafe7be113b0283817ed744bab9bf532 to your computer and use it in GitHub Desktop.
Count labels of one kind
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function countLabelsOfOneKind() | |
{ | |
var output = []; | |
new Trellinator().board("My Board").lists().each(function(list) | |
{ | |
output.push(list.name()+":\n"); | |
var current = {}; | |
list.cards().each(function(card) | |
{ | |
card.labels().each(function(label) | |
{ | |
if(!current[label.name()]) | |
{ | |
current[label.name()] = 0; | |
} | |
current[label.name()]++; | |
}); | |
output.push( | |
new IterableCollection(current).find(function(number,name) | |
{ | |
return name+": "+number; | |
}).asArray().join("\n"); | |
); | |
}); | |
}); | |
Logger.log(output.join("\n")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment