Bel LaPointe 2024-12-15 09:46:21 -07:00
parent d7e4196f61
commit 51c7cc4496
1 changed files with 7 additions and 10 deletions

View File

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