commit f6f40ff2bd310579b7325c60dd6be4656f0bbf51
parent a7c84439a29745f5a414ac9a5eba6670dbecd9bc
Author: Juan F. Meleiro <juan@juanmeleiro.mat.br>
Date: Wed, 7 Jun 2023 10:50:41 -0300
weekly: Add logic for doing deregistrations
Diffstat:
2 files changed, 40 insertions(+), 0 deletions(-)
diff --git a/deregistrations.jq b/deregistrations.jq
@@ -0,0 +1,14 @@
+[
+.[][] |
+select((.protected | not)
+ and has("active")
+ and (.active | not)
+ and (.latest |
+ strptime("%Y-%m-%d") |
+ mktime < (now - 5184000)))
+] |
+(
+"Cc: \([.[] | "\(.contact)" | gsub(" at "; "@") | gsub(" dot "; ".")] | join(", "))\n",
+"I intend, without 3 objections, to deregister the following players:\n",
+(.[] | "- \(.name)")
+)
diff --git a/weekly.fish b/weekly.fish
@@ -11,3 +11,29 @@ m4 weekly/weekly.m4
end > $tmp
neomutt -E -H $tmp
rm $tmp
+
+if jq -e '[.[][] | select(has("active") and (.active | not))] | length > 0' players.json > /dev/null
+ read -P 'There are players to be deregistered. Do it? [Yn]' -n 1 ans
+ if contains "$ans" n N no No NO
+ exit 0
+ end
+else
+ exit 0
+end
+
+set tmp (mktemp)
+
+begin
+echo 'Date: '(date -R)
+echo 'From: juan <juan@juanmeleiro.mat.br>'
+echo 'To: <agora-official@agoranomic.org>'
+echo 'Subject: [Registrar] Deregistration intents'
+jq -rf deregistrations.jq players.json
+end > $tmp
+neomutt -E -H $tmp
+rm $tmp
+
+begin
+echo 'TODO Deregister players in Agora'
+date -d 'now + 4 days' +'SCHEDULED: <%Y-%m-%d %a>'
+end | capture -i