store/tasks: dedupe live-status literal against the named constants (V-581)
lookupLiveTaskByNorm hardcoded 'candidate','open' in SQL, drifting from liveTaskStatuses which ListTasks already uses for the same query. Bind the constants instead so there is one place that names the live set.
This commit is contained in:
@@ -246,7 +246,7 @@ func (s *Store) lookupTaskByExternalID(ctx context.Context, ext string) (Task, e
|
||||
// lookupLiveTaskByNorm finds the outstanding task with this normalised text.
|
||||
func (s *Store) lookupLiveTaskByNorm(ctx context.Context, norm string) (Task, error) {
|
||||
row := s.db.QueryRowContext(ctx, taskSelect+`
|
||||
WHERE norm = ? AND status IN ('candidate','open')`, norm)
|
||||
WHERE norm = ? AND status IN (?,?)`, norm, liveTaskStatuses[0], liveTaskStatuses[1])
|
||||
t, err := scanTask(row)
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
return Task{}, ErrTaskNotFound
|
||||
|
||||
Reference in New Issue
Block a user