Commit 58420132 authored by Michał Zając's avatar Michał Zając

Rename occurrence_key to finding_key

parent 96278cf9
......@@ -76,7 +76,7 @@ module Vulnerabilities
comment.present? && comment_author.present?
end
def occurrence_key
def finding_key
{
project_id: project_id,
category: category,
......
......@@ -194,10 +194,10 @@ module Vulnerabilities
end
def load_feedback
BatchLoader.for(occurrence_key).batch(replace_methods: false) do |occurrence_keys, loader|
project_ids = occurrence_keys.map { |key| key[:project_id] }
categories = occurrence_keys.map { |key| key[:category] }
fingerprints = occurrence_keys.map { |key| key[:project_fingerprint] }
BatchLoader.for(finding_key).batch(replace_methods: false) do |finding_keys, loader|
project_ids = finding_keys.map { |key| key[:project_id] }
categories = finding_keys.map { |key| key[:category] }
fingerprints = finding_keys.map { |key| key[:project_fingerprint] }
feedback = Vulnerabilities::Feedback.all_preloaded.where(
project_id: project_ids.uniq,
......@@ -205,10 +205,10 @@ module Vulnerabilities
project_fingerprint: fingerprints.uniq
).to_a
occurrence_keys.each do |occurrence_key|
finding_keys.each do |finding_key|
loader.call(
occurrence_key,
feedback.select { |f| occurrence_key == f.occurrence_key }
finding_key,
feedback.select { |f| finding_key == f.finding_key }
)
end
end
......@@ -311,7 +311,7 @@ module Vulnerabilities
private
def occurrence_key
def finding_key
{
project_id: project_id,
category: report_type,
......
......@@ -157,7 +157,7 @@ RSpec.describe Gitlab::Ci::Reports::Security::Report do
let(:finding) { build(:ci_reports_security_finding, severity: nil) }
before do
subject.add_finding(finding)
subject.add_finding(finding)
end
it { expect(subject.unsafe_severity?).to be(false) }
......@@ -168,7 +168,7 @@ RSpec.describe Gitlab::Ci::Reports::Security::Report do
let(:finding) { build(:ci_reports_security_finding, severity: '') }
before do
subject.add_finding(finding)
subject.add_finding(finding)
end
it { expect(subject.unsafe_severity?).to be(false) }
......
......@@ -228,7 +228,7 @@ RSpec.describe Vulnerabilities::Feedback do
let(:expected_occurrence_key) { { project_id: project_id, category: category, project_fingerprint: project_fingerprint } }
let(:feedback) { build(:vulnerability_feedback, expected_occurrence_key) }
subject { feedback.occurrence_key }
subject { feedback.finding_key }
it { is_expected.to eq(expected_occurrence_key) }
end
......
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