// Find all linked tasks
const projectPage = dv.page(input.file);
const tasks = projectPage.file.inlinks.where((p) => {
    const mp = dv.page(p.path);
    return mp.tags?.includes("process/task");
});
const totalProjectTasksCompleted = projectPage.file.tasks.where(t => t.fullyCompleted === true).length;
let totalTasksCompleted = 0;
tasks.values.reduce((acc, p) => {
    const mp = dv.page(p.path);
    totalTasksCompleted += mp.file.tasks.where( (t) => t.fullyCompleted === true).length;
    return mp.file.tasks.length;
}, 0);

dv.span(totalProjectTasksCompleted + totalTasksCompleted);
