Run reviews and nudges on the state-driven coordinator
This commit is contained in:
@@ -158,9 +158,13 @@ func (s *Store) FreezeWorkflow(ctx context.Context, name string) (FrozenWorkflow
|
||||
}
|
||||
|
||||
func (s *Store) TaskWorkflow(ctx context.Context, taskID string) (FrozenWorkflow, error) {
|
||||
return taskWorkflow(ctx, s.db, taskID)
|
||||
}
|
||||
|
||||
func taskWorkflow(ctx context.Context, q querier, taskID string) (FrozenWorkflow, error) {
|
||||
f := FrozenWorkflow{}
|
||||
defID := sql.NullString{}
|
||||
err := s.db.QueryRowContext(ctx, `
|
||||
err := q.QueryRowContext(ctx, `
|
||||
SELECT r.workflow_name, r.workflow_definition_id, r.workflow_brief, r.workflow_title, r.audit
|
||||
FROM tasks t JOIN tasks r ON r.id = CASE WHEN t.workflow_stage != '' THEN t.parent_task_id ELSE t.id END
|
||||
WHERE t.id = ?`, taskID).Scan(&f.Name, &defID, &f.Brief, &f.Title, &f.Audit)
|
||||
@@ -174,7 +178,7 @@ func (s *Store) TaskWorkflow(ctx context.Context, taskID string) (FrozenWorkflow
|
||||
return FrozenWorkflow{}, fmt.Errorf("%w: task %s has no workflow", ErrNotFound, taskID)
|
||||
}
|
||||
f.DefinitionID = defID.String
|
||||
f.Definition, err = loadDefinition(ctx, s.db, f.DefinitionID)
|
||||
f.Definition, err = loadDefinition(ctx, q, f.DefinitionID)
|
||||
return f, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user