Get saved scan counts from finder

parent d3ca75aa
......@@ -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)
saved_scans = ::Dast::ProfilesFinder.new({ project_id: project.id }).execute
scheduled_scans = saved_scans.count { |scan| !scan.dast_profile_schedule.nil? }
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
common_data(project).merge({
'project-on-demand-scan-counts-etag' => graphql_etag_project_on_demand_scan_counts_path(project),
......@@ -14,8 +14,8 @@ module Projects::OnDemandScansHelper
all: on_demand_scans.length,
running: running_scan_count,
finished: finished_scan_count,
scheduled: scheduled_scans,
saved: saved_scans.length
scheduled: scheduled_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