Skip to content

Instantly share code, notes, and snippets.

@typeoneerror
Last active August 6, 2024 00:26
Show Gist options
  • Save typeoneerror/ce6fe41dd52b879451df2dd9dd301b61 to your computer and use it in GitHub Desktop.
Save typeoneerror/ce6fe41dd52b879451df2dd9dd301b61 to your computer and use it in GitHub Desktop.
Sort a Notion relation by value with highlights
prop("Videos")
.map(current.prop("Views"))
.sort()
.reverse()
.map(
lets(
views,
current,
prop("Videos").find(current.prop("Views") == views)
)
)
.map(
lets(color, index == 0 ? "red" : "",
current + " (" +
current.prop("Views")
.replace("(\d{1})(\d{3})$","$1,$2")
.replace("(\d{1})(\d{3},\d{3})$","$1,$2")
.style("b", color) +
")"
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment