Skip to content

Instantly share code, notes, and snippets.

@altercation
Last active December 29, 2023 22:54
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save altercation/7009493e77c85561388eb77040b11554 to your computer and use it in GitHub Desktop.
Save altercation/7009493e77c85561388eb77040b11554 to your computer and use it in GitHub Desktop.
Active Projects - Obsidian Dataview Sample - Ethan Schoonover
TABLE WITHOUT ID

	choice(striptime(date(today)) - striptime(file.mtime) <= dur("2 days"),
			"<span style=color:#859900;>●</span> ",
			choice(striptime(date(today)) - striptime(file.mtime) < dur("1 week"),
				"<span style=color:#b58900;>◐</span> ",
				"<span style=color:#dc322f;>⊗</span> "
			)
			) +
	link(file.link, ""
	
		+ " " + truncate(choice(nickname, nickname, choice(title, title, file.name)),30,"…")
	
	)
	as "Project",

	choice(striptime(date(today)) = striptime(file.mtime),
			"<span style=color:#859900;>✓✓</span> ",
			choice(striptime(date(today)) - striptime(file.mtime) < dur("2 days"),"<span style=color:#859900;>✓</span> ",
			choice(striptime(date(today)) - striptime(file.mtime) < dur("1 week"),
				"<span style=color:#b58900;>" + (round((date(today) - file.mday).days)) + "d</span> ",
				"<span style=color:#dc322f;>" + (round((date(today) - file.mday).weeks)) + "w</span> "
			)
			)
			)
	as "↺",

	choice(default(priority,0) = 0, " ", choice(priority > 0, "<span style=color:#d33682;>▲</span> ", "<span>▽</span> "))
	as "!",

	" " + 
	choice(scheduled and !due, "\>>> ",
			choice(scheduled and due, "\>>| ",
				choice(due, "->| ", "\--> ")
			)
	)
	+
	choice(scheduled and (scheduled <= default(due,scheduled)),
		(
		choice(scheduled - date(today) > dur("2 years"), round(dur(scheduled - date(today)).years) + "y", 
		choice(scheduled - date(today) > dur("3 months"), round(dur(scheduled - date(today)).months) + "m",
		choice(scheduled - date(today) > dur("2 weeks"), round(dur(scheduled - date(today)).weeks) + "w",
		"<span style=color:#dc322f;>" + round(dur(scheduled - date(today)).days) + "d</span>"
		)))),
			choice(due,
			(
			choice(due - date(today) > dur("2 years"), round(dur(due - date(today)).years) + "y", 
			choice(due - date(today) > dur("3 months"), round(dur(due - date(today)).months) + "m",
			choice(due - date(today) > dur("2 weeks"), round(dur(due - date(today)).weeks) + "w",
			"<span style=color:#dc322f;>" + round(dur(due - date(today)).days) + "d</span>"
			)))),
				"?"
			)
	)
	as "Pitch",

	choice(length(file.tasks) - length(filter(file.tasks, (r) => r.completed)) = 0,"<span style=color:#dc322f;>-</span>","<span style=color:#859900;>+</span>") AS "✓",
	
	truncate(summary,60,"…") as "Summary",
	
	upper(split(file.path,"/",1)[0]) as "CAT"
	
FROM -"!scaffolding"
WHERE type = "project" and status = "active" 
	AND (!completed and !completion)
	AND (start <= date(today))
	AND !contains(file.path, "_") 
	AND !contains(file.path, "!")
SORT choice(scheduled and (scheduled <= default(due,scheduled)),scheduled,default(due,1)) ASC, default(priority,0) DESC, file.name ASC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment