Skip to content

Instantly share code, notes, and snippets.

@michaelgold
Created February 21, 2024 05:10
Show Gist options
  • Save michaelgold/70e4d124d56ba238faab79922858d9af to your computer and use it in GitHub Desktop.
Save michaelgold/70e4d124d56ba238faab79922858d9af to your computer and use it in GitHub Desktop.

Tasks

Priority Tasks


	dv.table(["Status", "Task", "Link",], dv.pages().file.tasks
	.where(t => {
		console.log("today:")
		console.log(dv.date('today'))
		const isScheduled = t.scheduled <= dv.date('today')
		const isDue = t.due <= dv.date('today')
		const highPriorityString = "⏫"
		const isHighPriority = t.text.includes(highPriorityString)
        return !t.completed && (t.status == '/' || t.status == '!' || isScheduled || isDue || isHighPriority )  }
        )
		 .sort(t => t.status, "desc")
		 //.map(t => [t.status, `[${t.text}](${t.link})`,])
		 .map(t => [t.status, t.text, dv.blockLink(t.link.path, t.link.subpath)])
		 )

Log

08:00 AM

Other Tasks

Done Today


const tasks = dv.pages().file.tasks
	.where(t => {
		const filename = dv.current().file.name
		const completionDate = t?.completion?.c
		const filenameArray = filename.split("-")
		const dateFromFilenameArray = filenameArray.map(Number)
		const dateArray = [completionDate?.year, completionDate?.month, completionDate?.day]
		const isCompletedToday = () => dateFromFilenameArray.toString() == dateArray.toString()
		
        return isCompletedToday() 
                 // exclude completed tasks and ones without in progress or important
	});

if(tasks.length === 0) {
	dv.el("b", "Nothing yet")
} else {
	dv.taskList(tasks, false);
}

Incomplete Tasks by File


	dv.table(["Date", "Task", "Status"], dv.pages().file.tasks.
	where(t => {
        return !t.completed // exclude completed tasks 
		;
	}) 
		 .sort(t => dv.fileLink(t.path), 'desc')
		 .map(t => [dv.blockLink(t.link.path, t.link.subpath), t.text, t.status]))
		 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment