// StepModels is the model each of the person's own steps ran on, as its
10
// harness reported it with the attempt's usage (the newest row wins). A
11
// step that has not reported usage yet, or that ran on someone else's
12
// runner, is absent: the model is unknown, never guessed.
13
func (s *Store) StepModels(ctx context.Context, person string, steps []string) (map[string]string, error) {
14
out := map[string]string{}
15
if len(steps) == 0 {
16
return out, nil
17
}
18
err := s.read(ctx, func(tx *gorm.DB) error {
19
if err := s.authority.CurrentPerson(ctx, tx); err != nil {
20
return err
21
}
22
var rows []usageRecord
23
if err := tx.Select("step_id", "model", "recorded_at", "id").Where("person = ? AND step_id IN ? AND model <> ''", person, steps).Order("recorded_at, id").Find(&rows).Error; err != nil {