From 43ac4b031f9c3e80f0a25f314f3d8df51dd640ef Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Tue, 14 Sep 2021 17:10:40 +1000 Subject: [PATCH] fix: fix bug identifying latest verification for tagged pact --- lib/pact_broker/index/service.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pact_broker/index/service.rb b/lib/pact_broker/index/service.rb index c76e49195..508cc961d 100644 --- a/lib/pact_broker/index/service.rb +++ b/lib/pact_broker/index/service.rb @@ -112,11 +112,11 @@ def self.latest_verification_for_pseudo_branch(pact_publication, is_overall_late elsif tags_option == true latest_verifications_for_cv_tags .select{ | v | v.consumer_id == pact_publication.consumer_id && v.provider_id == pact_publication.provider_id && pact_publication.head_pact_tags.collect(&:name).include?(v.consumer_version_tag_name) } - .sort{ |v1, v2| v1.id <=> v2.id }.last || (is_overall_latest && pact_publication.integration.latest_verification) + .sort{ |v1, v2| v1.id <=> v2.id }.last || (is_overall_latest ? pact_publication.integration.latest_verification : nil) elsif tags_option.is_a?(Array) latest_verifications_for_cv_tags .select{ | v | v.consumer_id == pact_publication.consumer_id && v.provider_id == pact_publication.provider_id && pact_publication.head_pact_tags.collect(&:name).include?(v.consumer_version_tag_name) && tags_option.include?(v.consumer_version_tag_name) } - .sort{ |v1, v2| v1.id <=> v2.id }.last || (is_overall_latest && pact_publication.integration.latest_verification) + .sort{ |v1, v2| v1.id <=> v2.id }.last || (is_overall_latest ? pact_publication.integration.latest_verification : nil) else pact_publication.integration.latest_verification end