registrar

Files related to my duties as Registrar of Agora Nomic
git clone git://juanmeleiro.mat.br/registrar
Log | Files | Refs | README

commit 46d947b5b18d8db2ce895d16e635e90c6e1ef699
parent 2d74b16eff9becbab95309806086a38dce98cb14
Author: Juan F. Meleiro <juan@juanmeleiro.mat.br>
Date:   Wed, 15 May 2024 09:31:31 +0200

Fix incompatibility between registration and new players.json format

Diffstat:
Mlib/registration.lua | 13++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/lib/registration.lua b/lib/registration.lua @@ -59,13 +59,12 @@ function _M.register(args, players, log, ts) local exists = nil -- Check if player name exists for p, h in pairs(players) do - if table.query(h, function (x) return x.name == args.name end) then - if table.query(h, function (x) return x.reason == "s" end) then + if table.query(h.history, function (x) return x.name == args.name end) then + exists = p + if table.query(h.history, function (x) return x.reason == "s" end) then die(string.format("Error: player '%s' exists and is registered.", p)) - else - exists = p - break end + break end end if exists then @@ -78,8 +77,8 @@ function _M.register(args, players, log, ts) -- Query player's birthday birthday = players[args.name].history[1].registration for _,h in ipairs(players[args.name].history) do - if first > h.registration then - first = h.registration + if birthday > h.registration then + birthday = h.registration end end end