From 60d7192e042cdd3ea6ef6fc76b24edc2b91c20bb Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Wed, 14 Oct 2020 09:52:19 -0600 Subject: [PATCH] Properly anonymize all point log entries --- cmd/mothd/server.go | 2 +- cmd/mothd/server_test.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/mothd/server.go b/cmd/mothd/server.go index 97c90b3..ad929b5 100644 --- a/cmd/mothd/server.go +++ b/cmd/mothd/server.go @@ -196,7 +196,7 @@ func (mh *MothRequestHandler) exportStateIfRegistered(override bool) *StateExpor } else { exportID := strconv.Itoa(logno) name, _ := mh.State.TeamName(awd.TeamID) - exportIDs[awd.TeamID] = awd.TeamID + exportIDs[awd.TeamID] = exportID awd.TeamID = exportID export.TeamNames[exportID] = name } diff --git a/cmd/mothd/server_test.go b/cmd/mothd/server_test.go index 9144b2e..f6695ac 100644 --- a/cmd/mothd/server_test.go +++ b/cmd/mothd/server_test.go @@ -142,6 +142,12 @@ func TestServer(t *testing.T) { if len(es.TeamNames) != 2 { t.Error("Anonymous TeamNames is wrong:", es.TeamNames) } + if len(es.PointsLog) != 2 { + t.Error("Points log wrong length") + } + if es.PointsLog[1].TeamID != "0" { + t.Error("Second point log didn't anonymize team ID correctly:", es.PointsLog[1]) + } es = handler.ExportState() if len(es.TeamNames) != 1 {