Refactor project traversal_ids as sql

Summary

The code that turns the traversal IDs of a project into an SQL array is repeated, and it should be shared.

traversal_ids_as_sql = "'{#{project.namespace.traversal_ids.join(',')}}'"`

!180343 (comment 2333709935)

Improvements

This improves code readability.

Risks

None

Involved components

  • ee/app/services/security/ingestion/tasks/ingest_vulnerability_statistics.rb
  • ee/app/services/vulnerabilities/statistics/adjustment_service.rb
  • ee/app/services/vulnerabilities/statistics/update_service.rb

Optional: Intended side effects

None

Optional: Missing test coverage

None

Implementation plan

Add a new method to the Project class, and use it in the aforementioned involved components.

/cc @arpitgogia

Edited by Fabien Catteau