From 51c7cc4496f65d89f3141174ee7f30a5816746a5 Mon Sep 17 00:00:00 2001 From: Bel LaPointe <153096461+breel-render@users.noreply.github.com> Date: Sun, 15 Dec 2024 09:46:21 -0700 Subject: [PATCH] sh --- cmd/server/games.go | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/cmd/server/games.go b/cmd/server/games.go index 7b43ef4..c833a33 100644 --- a/cmd/server/games.go +++ b/cmd/server/games.go @@ -383,26 +383,23 @@ func (games Games) CreateEventAssignmentRotation(ctx context.Context, id string, func (m AllKillWords) ShuffleAssignees(prev AllKillWords, killer, victim, word string) { now := time.Now() - for k, v := range prev { + for k := range prev { m[k] = KillWords{ - Global: v.Global, + Global: prev[k].Global, Assigned: now, Assignee: "", - Assignment: v.Assignment, + Assignment: prev[k].Assignment, } } if killerState, ok := prev[killer]; !ok { } else if victimState, ok := prev[victim]; !ok { } else { - m[killer] = KillWords{ - Global: killerState.Global, - Assigned: now, - Assignee: victimState.Assignee, - Assignment: killerState.Assignment, - } + v := m[killer] + v.Assignee = victimState.Assignee + m[killer] = v - if killerState.Global.Word != word { + if assignmentKilled := killerState.Global.Word != word; assignmentKilled { victimState.Assignment = Assignment{} prev[victim] = victimState }