Skip to content

Instantly share code, notes, and snippets.

@iaindooley
Created March 11, 2020 00:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iaindooley/95fde6db4e4547ef9e81da3bb07f64ef to your computer and use it in GitHub Desktop.
Save iaindooley/95fde6db4e4547ef9e81da3bb07f64ef to your computer and use it in GitHub Desktop.
Report with card counts
function reportWithCardCounts(board,signature,original_time)
{
var completed_by_members = {};
new Board(board).list(/Completed Tasks/i).cards().each(function(card)
{
try
{
var mem = card.members().first().name();
if(!completed_by_members[mem])
completed_by_members[mem] = [];
completed_by_members[mem].push(card.name()+" ("+card.link()+")");
}
catch(e)
{
Notification.expectException(InvalidDataException,e);
}
});
var output = [];
new IterableCollection(completed_by_members).each(function(lines,name)
{
var word = lines.length > 1 ? "Tasks":"Task";
output.push(name+" - "+lines.length+" "+word+"\n\n -"+lines.join("\n -")+"\n\n");
});
MailApp.send("reports@domain.com","Report for "+Trellinator.now().butlerDefaultDate(),output.join("\n"));
ExecutionQueue.push("reportWithCardCounts",board,signature,original_time.addDays(1).at("18:00"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment