diff --git a/cmd/server/games.go b/cmd/server/games.go index b085111..330fa5c 100644 --- a/cmd/server/games.go +++ b/cmd/server/games.go @@ -365,7 +365,6 @@ func (games Games) CreateEventAssignmentRotation(ctx context.Context, id string, Word: word, Points: points, }, - AllKillWords: make(AllKillWords), } prevAllKillWords := make(AllKillWords) @@ -373,15 +372,13 @@ func (games Games) CreateEventAssignmentRotation(ctx context.Context, id string, prevAllKillWords[k] = v.KillWords } - event.AllKillWords = prev.ShuffleAssignees(killer, victim, word) + event.AllKillWords = prevAllKillWords.ShuffleAssignees(killer, victim, word) event.AllKillWords = event.AllKillWords.FillKillWords() return games.createEvent(ctx, id, event) } func (prev AllKillWords) ShuffleAssignees(killer, victim, word string) AllKillWords { - now := time.Now() - m := prev.withoutAssignees() if killerState, ok := prev[killer]; !ok { @@ -411,12 +408,8 @@ func (prev AllKillWords) ShuffleAssignees(killer, victim, word string) AllKillWo if k == assignee || prev[k].Assignee == assignee { return false } - allKillWords[k] = KillWords{ - Global: v.Global, - Assigned: now, - Assignee: assignee, - Assignment: v.Assignment, - } + v.Assignee = assignee + allKillWords[k] = v } m = allKillWords @@ -428,6 +421,7 @@ func (prev AllKillWords) ShuffleAssignees(killer, victim, word string) AllKillWo } func (m AllKillWords) withoutAssignees() AllKillWords { + now := time.Now() result := make(AllKillWords) for k := range m { result[k] = KillWords{