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:
2026-08-06 02:10:22 +04:00
parent 0886662360
commit aaf1f0236b
+1 -1
View File
@@ -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