Count scheduled scans in memory

parent 8dc36b19
......@@ -5,8 +5,8 @@ module Projects::OnDemandScansHelper
def on_demand_scans_data(project)
on_demand_scans = project.all_pipelines.where(source: Enums::Ci::Pipeline.sources[:ondemand_dast_scan])
running_scan_count, finished_scan_count = count_running_and_finished_scans(on_demand_scans)
scheduled_scans_count = ::Dast::ProfilesFinder.new({ project_id: project.id, has_dast_profile_schedule: true }).execute.count
saved_scans_count = ::Dast::ProfilesFinder.new({ project_id: project.id }).execute.count
saved_scans = ::Dast::ProfilesFinder.new({ project_id: project.id }).execute
scheduled_scans_count = saved_scans.count { |scan| scan.dast_profile_schedule }
common_data(project).merge({
'project-on-demand-scan-counts-etag' => graphql_etag_project_on_demand_scan_counts_path(project),
......@@ -15,7 +15,7 @@ module Projects::OnDemandScansHelper
running: running_scan_count,
finished: finished_scan_count,
scheduled: scheduled_scans_count,
saved: saved_scans_count
saved: saved_scans.count
}.to_json,
'new-dast-scan-path' => new_project_on_demand_scan_path(project),
'empty-state-svg-path' => image_path('illustrations/empty-state/ondemand-scan-empty.svg'),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment