mirror of https://github.com/dirtbags/moth.git
Only anonymize team IDs once per team
This commit is contained in:
parent
2d3c707205
commit
843996f2c4
|
@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Multiple bugs preventing production server from working properly
|
- Multiple bugs preventing production server from working properly
|
||||||
- CI builds should be working now
|
- CI builds should be working now
|
||||||
- Team registration now correctly writes names to files
|
- Team registration now correctly writes names to files
|
||||||
|
- Anonymized team names now only computed once per team
|
||||||
|
|
||||||
## [v4.0-rc1] - 2020-10-13
|
## [v4.0-rc1] - 2020-10-13
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
@ -196,8 +196,8 @@ func (mh *MothRequestHandler) exportStateIfRegistered(override bool) *StateExpor
|
||||||
} else {
|
} else {
|
||||||
exportID := strconv.Itoa(logno)
|
exportID := strconv.Itoa(logno)
|
||||||
name, _ := mh.State.TeamName(awd.TeamID)
|
name, _ := mh.State.TeamName(awd.TeamID)
|
||||||
awd.TeamID = exportID
|
|
||||||
exportIDs[awd.TeamID] = awd.TeamID
|
exportIDs[awd.TeamID] = awd.TeamID
|
||||||
|
awd.TeamID = exportID
|
||||||
export.TeamNames[exportID] = name
|
export.TeamNames[exportID] = name
|
||||||
}
|
}
|
||||||
export.PointsLog[logno] = awd
|
export.PointsLog[logno] = awd
|
||||||
|
|
|
@ -133,5 +133,20 @@ func TestServer(t *testing.T) {
|
||||||
r.Close()
|
r.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := handler.CheckAnswer("pategory", 2, "wat"); err != nil {
|
||||||
|
t.Error("Right answer marked wrong:", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
time.Sleep(TestMaintenanceInterval)
|
||||||
|
es = anonHandler.ExportState()
|
||||||
|
if len(es.TeamNames) != 2 {
|
||||||
|
t.Error("Anonymous TeamNames is wrong:", es.TeamNames)
|
||||||
|
}
|
||||||
|
|
||||||
|
es = handler.ExportState()
|
||||||
|
if len(es.TeamNames) != 1 {
|
||||||
|
t.Error("TeamNames is wrong:", es.TeamNames)
|
||||||
|
}
|
||||||
|
|
||||||
// BUG(neale): We aren't currently testing the various ways to disable the server
|
// BUG(neale): We aren't currently testing the various ways to disable the server
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,6 +89,10 @@ func TestState(t *testing.T) {
|
||||||
t.Error("Duplicate points award didn't fail")
|
t.Error("Duplicate points award didn't fail")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := s.AwardPoints(teamID, category, points+1); err != nil {
|
||||||
|
t.Error("Awarding more points:", err)
|
||||||
|
}
|
||||||
|
|
||||||
pl = s.PointsLog()
|
pl = s.PointsLog()
|
||||||
if len(pl) != 1 {
|
if len(pl) != 1 {
|
||||||
t.Errorf("After awarding points, points log has length %d", len(pl))
|
t.Errorf("After awarding points, points log has length %d", len(pl))
|
||||||
|
@ -104,7 +108,7 @@ func TestState(t *testing.T) {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
||||||
s.refresh()
|
s.refresh()
|
||||||
if len(s.PointsLog()) != 1 {
|
if len(s.PointsLog()) != 2 {
|
||||||
t.Error("Intentional parse error screws up all parsing")
|
t.Error("Intentional parse error screws up all parsing")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue