Created
March 11, 2020 00:48
-
-
Save iaindooley/95fde6db4e4547ef9e81da3bb07f64ef to your computer and use it in GitHub Desktop.
Report with card counts
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 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