Tasks completed in week (weekly notes)

I tried to find a solution to get a list of tasks completed every week.
Maybe someone will find it useful.
I use tasks plugin and dataview.

Improvement ideas are welcome.

dv.date(dv.current().file.cday).startOf("week").toISO();
if (!dv.current().file.name.includes("template")) {
  dv.taskList(
    dv
      .pages()
      .file.tasks.where(
        (t) =>
          t.text.includes("✅ " + dv.date(dv.current().file.cday).startOf("week").toISODate()) ||
          t.text.includes("✅ " + dv.date(dv.current().file.cday).startOf("week").plus({ days: 1 }).toISODate()) ||
          t.text.includes("✅ " + dv.date(dv.current().file.cday).startOf("week").plus({ days: 2 }).toISODate()) ||
          t.text.includes("✅ " + dv.date(dv.current().file.cday).startOf("week").plus({ days: 3 }).toISODate()) ||
          t.text.includes("✅ " + dv.date(dv.current().file.cday).startOf("week").plus({ days: 4 }).toISODate()) ||
          t.text.includes("✅ " + dv.date(dv.current().file.cday).startOf("week").plus({ days: 5 }).toISODate()) ||
          t.text.includes("✅ " + dv.date(dv.current().file.cday).startOf("week").plus({ days: 6 }).toISODate())
      ),

    false
  );
} else {
  dv.paragraph("It's a template -> It will execute in note - list of tasks completed this week");
}

3 Likes