Hi,
I am trying to display a list of users on a page. These need to be sorted by a calculated value, which comes from two dates in the user content file.
I can display the value I want to use by individual user like this:
$delta =
$kirby->user()->found()->toStructure()->last()->scanned()->toDate() - $kirby->user()->found()->toStructure()->first()->scanned()->toDate()
But now I need to do a “leaderboard”, which needs to be sorted like this (pseudo code to show what I mean):
$leaderboard = $users->filterBy('role','entrant')->sortBy({$delta calculated as above})
What is the best way of approaching this? Thanks for any guidance.