complete game pls
parent
9dd661ecd0
commit
130f8122b6
|
|
@ -337,10 +337,19 @@ func (games Games) CreateEventAssignmentRotation(ctx context.Context, id string,
|
|||
}() {
|
||||
}
|
||||
|
||||
// TODO generate .Global, .Assignments.Public, .Assignments.Private and
|
||||
|
||||
return games.createEvent(ctx, id, event)
|
||||
}
|
||||
|
||||
func (games Games) CreateEventGameComplete(ctx context.Context, id string) error {
|
||||
if err := games.db.Exec(ctx, `
|
||||
UPDATE games
|
||||
SET completed=?, updated=?
|
||||
WHERE uuid=?
|
||||
`, time.Now(), time.Now(), id); err != nil {
|
||||
return err
|
||||
}
|
||||
return games.createEvent(ctx, id, EventGameComplete{Type: GameComplete})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -104,5 +104,13 @@ func TestGames(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if err := games.CreateEventGameComplete(ctx, id); err != nil {
|
||||
t.Fatal("err creating game complete:", err)
|
||||
} else if state, err := games.GameState(ctx, id); err != nil {
|
||||
t.Fatal("err fetching state after completing:", err)
|
||||
} else if state.Completed.IsZero() {
|
||||
t.Fatal("state.Completed is zero")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue