commit 6e768e0103173830651f7a0f6a79de71d4d55c68
parent 22822e39cf7d23a8012794fcbc5f951e48df3d97
Author: Juan F. Meleiro <juan@juanmeleiro.mat.br>
Date: Mon, 6 Nov 2023 12:45:08 -0300
Factor out player-list logic and add sorting
Diffstat:
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/lib/playerlist.jq b/lib/playerlist.jq
@@ -0,0 +1,8 @@
+[
+ .[][] |
+ select(.reason == "s")
+] |
+ sort_by(.registration) |
+ sort_by(.active | not) |
+ .[] |
+ "\(if .active then "+" else "-" end)\t\(.name)\t\(.registration)\t\(.latest // " \" ")\t\(.contact)"
diff --git a/lib/playerlist.sh b/lib/playerlist.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+jq -r -f lib/playerlist.jq players.json | columnate -n a Player Registration Latest Contact
diff --git a/templates/weekly/players.m4 b/templates/weekly/players.m4
@@ -1,6 +1,6 @@
Active players: esyscmd(jq -r '[.[][] | select(.reason == "s")] | "\([.[] | select(.active == true)] | length)/\(length)"' players.json)dnl
-esyscmd(jq -r '[.[][] | select(.reason == "s")] | sort_by(.active | not)[] | "\(if .active then "+" else "-" end)\t\(.name)\t\(.registration)\t\(.latest // " \" ")\t\(.contact)"' players.json | columnate -n a Player Registration Latest Contact)dnl
+esyscmd(lib/playerlist.sh)dnl
WARNING: Player name “blob” refers to the currently registered one,
who became a player on 2023-05-18, and not blob the player from many