Skip to content

Instantly share code, notes, and snippets.

@iaindooley
Last active May 11, 2019 20:12
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/450eea8a387df9dccf443b68f5d57040 to your computer and use it in GitHub Desktop.
Save iaindooley/450eea8a387df9dccf443b68f5d57040 to your computer and use it in GitHub Desktop.
Build dashboard
//SCHEDULE DAILY AT 5AM OR SOMETHING
function buildDashboard(params,signature,original_time)
{
var mins = 10;
new Trellinator().boards().each(function(board)
{
ExecutionQueue.push("buildDashForBoard",{dash_id: params.id,board_id: board.id()},signature+"-buildDashForBoard",new Date(original_time).addMinutes(mins));
mins = mins + 10;
});
ExecutionQueue.push("buildDashboard",params,signature,original_time.addHours(24));
}
//THIS IS SCHEDULED BY THE ABOVE FUNCTION
function buildDashForBoard(params);
{
var dash = new Board({id: params.dash_id});
var board = new Board({id: params.board_id});
board.cards().each(function(card)
{
if(card.due() && (card.due().getTime() > Trellinator.now().minusHours(24).getTime()))
{
card.members().each(function(member)
{
Card.create(dash.findOrCreateList(member.name()),card.name()).attachLink(card.link()).setDue(card.due());
});
)
});
dash.lists().each(function(list)
{
list.sort(List.SORT_DATE_ASC);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment