Skip to content

Instantly share code, notes, and snippets.

@iaindooley
Created August 22, 2020 01:26
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/884bd51ca75f3278b41d39c7ca1bf40b to your computer and use it in GitHub Desktop.
Save iaindooley/884bd51ca75f3278b41d39c7ca1bf40b to your computer and use it in GitHub Desktop.
Completed percentage
function completedPercentage(notification)
{
var completed = new Notification(notification).completedChecklistItem();
var num_complete = completed.checklist().items().find(function(item)
{
if(item.isComplete())
return item;
else
return false;
}).length();
var num_items = completed.checklist().items().length();
completed.checklist().card().setCustomFieldValue("Percentage Complete",new Number((num_complete*100)/num_items).toFixed(2));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment