Properly anonymize all point log entries

This commit is contained in:
Neale Pickett 2020-10-14 09:52:19 -06:00
parent 843996f2c4
commit 60d7192e04
2 changed files with 7 additions and 1 deletions

View File

@ -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
}

View File

@ -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 {