From 2523982af0f575ed4542cb1f8248a86708694856 Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Thu, 8 Feb 2018 13:11:08 +1100 Subject: [PATCH] feat(index): sort verifications by execution date Have found a lot of provider versions with nil order, need to investigate why --- lib/pact_broker/index/service.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pact_broker/index/service.rb b/lib/pact_broker/index/service.rb index 08c60f0a2..ec7412a84 100644 --- a/lib/pact_broker/index/service.rb +++ b/lib/pact_broker/index/service.rb @@ -61,7 +61,9 @@ def self.find_index_items options = {} tag_names.collect do | tag_name | verification_repository.find_latest_verification_for row.consumer_name, row.provider_name, tag_name end.compact.sort do | v1, v2 | - v1.provider_version.order <=> v2.provider_version.order + # Some provider versions have nil orders, not sure why + # Sort by execution_date instead of order + v1.execution_date <=> v2.execution_date end.last end