From 47122fc7205da633e6091bf8010f252acecb61b6 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Thu, 28 May 2015 11:40:41 -0600 Subject: [PATCH] Just send team hashes so we can recover from crash --- bin/points | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/bin/points b/bin/points index 96bd570..5d27027 100755 --- a/bin/points +++ b/bin/points @@ -17,14 +17,14 @@ BEGIN { teamno = ++nteams; teams[hash] = teamno; - getline teamnames[teamno] < ("state/teams/" hash) + getline teamnames[hash] < ("state/teams/" hash) } if (NR > 1) { # JSON sucks. print ","; } - printf("[%d, \"%d\", \"%s\", %d]", ts, teamno, cat, points); + printf("[%d, \"%s\", \"%s\", %d]", ts, hash, cat, points); } END { @@ -32,11 +32,12 @@ END { print " ],"; print " \"teams\": {"; - for (i = 1; i <= nteams; i += 1) { - if (i > 1) { - print ","; - } - printf("\"%d\": \"%s\"", i, teamnames[i]); + i = 0 + for (hash in teamnames) { + if (i++) { + print ","; + } + printf("\"%s\": \"%s\"", hash, teamnames[hash]); } print "";