From a630389acbb18dfbf2d4586572a6f3608da5f8a5 Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Fri, 28 Apr 2023 12:37:55 +1000 Subject: [PATCH] chore: de-duplicate pacticipant ids used in matrix query --- lib/pact_broker/matrix/query_ids.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/pact_broker/matrix/query_ids.rb b/lib/pact_broker/matrix/query_ids.rb index a4d7e3a94..1286f50c5 100644 --- a/lib/pact_broker/matrix/query_ids.rb +++ b/lib/pact_broker/matrix/query_ids.rb @@ -17,10 +17,10 @@ def initialize(all_pacticipant_ids, specified_pacticipant_ids, pacticipant_ids, def self.from_selectors(selectors) most_specific_criteria = selectors.collect(&:most_specific_criterion) - all_pacticipant_ids = selectors.collect(&:pacticipant_id) - specified_pacticipant_ids = selectors.select(&:specified?).collect(&:pacticipant_id) - pacticipant_version_ids = collect_ids(most_specific_criteria, :pacticipant_version_id) - pacticipant_ids = collect_ids(most_specific_criteria, :pacticipant_id) + all_pacticipant_ids = selectors.collect(&:pacticipant_id).uniq + specified_pacticipant_ids = selectors.select(&:specified?).collect(&:pacticipant_id).uniq + pacticipant_version_ids = collect_ids(most_specific_criteria, :pacticipant_version_id).uniq + pacticipant_ids = collect_ids(most_specific_criteria, :pacticipant_id).uniq QueryIds.new(all_pacticipant_ids, specified_pacticipant_ids, pacticipant_ids, pacticipant_version_ids) end