Skip to content

Instantly share code, notes, and snippets.

@typeoneerror
Created September 20, 2023 16:19
Show Gist options
  • Save typeoneerror/f3f5bf94be7c991c92ee26f1237eb0b0 to your computer and use it in GitHub Desktop.
Save typeoneerror/f3f5bf94be7c991c92ee26f1237eb0b0 to your computer and use it in GitHub Desktop.
lets(
/* Find all unfinished tasks */
tasks, prop("Tasks").filter(current.prop("Status") != "Done"),
/* Find all the people assigned to those tasks */
people,
tasks
.map(current.prop("Assignee"))
/**
* Because Assignee is a Person property, it's a list,
* so we have to flatten this list of lists, make it unique, and sort.
*/
.flat()
.unique()
.sort(),
/* Finally we build a list of "assignments" */
assignments,
people.map(
/**
* For each person, we're going to find any related unfinished tasks assigned to them.
* We need to set an alias called "person" because we'll need to use nested "current"s here
*/
let(person, current,
/* Output the person's name and concat a string... */
person + " is working on\n" +
/* Find all their tasks, sort them... */
tasks
.filter(current.prop("Assignee").includes(person))
.sort()
/* Then for each of them return the name of the task with a tab character in front of it */
.map("\t" + current)
/* Join all the tasks together with a newline */
.join("\n")
)
),
/* Add double newlines between users */
assignments.join("\n\n")
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment