functional looking
parent
51c7cc4496
commit
b9d06f81ba
|
|
@ -373,14 +373,13 @@ func (games Games) CreateEventAssignmentRotation(ctx context.Context, id string,
|
|||
prevAllKillWords[k] = v.KillWords
|
||||
}
|
||||
|
||||
event.AllKillWords.ShuffleAssignees(prevAllKillWords, killer, victim, word)
|
||||
|
||||
event.AllKillWords.FillKillWords()
|
||||
event.AllKillWords = event.AllKillWords.ShuffleAssignees(prevAllKillWords, killer, victim, word)
|
||||
event.AllKillWords = event.AllKillWords.FillKillWords()
|
||||
|
||||
return games.createEvent(ctx, id, event)
|
||||
}
|
||||
|
||||
func (m AllKillWords) ShuffleAssignees(prev AllKillWords, killer, victim, word string) {
|
||||
func (m AllKillWords) ShuffleAssignees(prev AllKillWords, killer, victim, word string) AllKillWords {
|
||||
now := time.Now()
|
||||
|
||||
for k := range prev {
|
||||
|
|
@ -427,12 +426,12 @@ func (m AllKillWords) ShuffleAssignees(prev AllKillWords, killer, victim, word s
|
|||
}
|
||||
}
|
||||
|
||||
for k, v := range allKillWords {
|
||||
m[k] = v
|
||||
}
|
||||
m = allKillWords
|
||||
return true
|
||||
}() {
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func (m AllKillWords) unassigned() []string {
|
||||
|
|
@ -461,7 +460,7 @@ func (m AllKillWords) assigned() []string {
|
|||
return result
|
||||
}
|
||||
|
||||
func (m AllKillWords) FillKillWords() {
|
||||
func (m AllKillWords) FillKillWords() AllKillWords {
|
||||
for k, v := range m {
|
||||
if v.Global.Word == "" {
|
||||
v.Global = KillWord{Word: m.unusedGlobal(), Points: -1}
|
||||
|
|
@ -482,6 +481,7 @@ func (m AllKillWords) FillKillWords() {
|
|||
}
|
||||
}
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
//go:embed holiday.txt
|
||||
|
|
|
|||
Loading…
Reference in New Issue