Skip to content

Instantly share code, notes, and snippets.

@avernet
Created March 8, 2026 03:06
Show Gist options
  • Select an option

  • Save avernet/1ef23fbdfe089015f34183c543312672 to your computer and use it in GitHub Desktop.

Select an option

Save avernet/1ef23fbdfe089015f34183c543312672 to your computer and use it in GitHub Desktop.
const descendants = WF.currentItem().getChildren().flatMap(function getDesc(item) {
return [item, ...item.getChildren().flatMap(getDesc)];
});
const completed = descendants.filter(item => item.isCompleted() && !item.isReadOnly());
if (completed.length === 0) {
WF.showMessage("No completed items found.", false);
} else {
WF.editGroup(() => completed.forEach(item => WF.completeItem(item)));
WF.showMessage(`Uncompleted ${completed.length} item(s).`);
setTimeout(WF.hideMessage, 5000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment