lib/pact_broker/matrix/repository.rb
# rubocop: disable Metrics/CyclomaticComplexity
# It would be nicer to do this in the SQL, but it requires time that I don't have at the moment
disable Metrics/CyclomaticComplexity
It would be nicer to do this in the SQL, but it requires time that I don't have at the moment
disable Metrics / CyclomaticComplexity It would be nicer to do this in the SQL but it requires time that I don ' t have at the moment
def apply_latestby options, lines
        return lines unless options[:latestby]
        group_by_columns = case options[:latestby]
                           when "cvpv" then GROUP_BY_PROVIDER_VERSION_NUMBER
                           when "cvp" then GROUP_BY_PROVIDER
                           when "cp" then GROUP_BY_PACT
                           end
        lines.group_by{|line| group_by_columns.collect{|key| line.send(key) }}
          .values
          .collect{ | line | line.first.provider_version_number.nil? ? line : line.sort_by(&:provider_version_order).last }
          .flatten
      end
def apply_latestby options , lines return lines unless options [ :latestby ] group_by_columns = case options [ :latestby ] when "cvpv" then GROUP_BY_PROVIDER_VERSION_NUMBER when "cvp" then GROUP_BY_PROVIDER when "cp" then GROUP_BY_PACT end lines . group_by { | line | group_by_columns . collect { | key | line . send ( key ) } } . values . collect { | line | line . first . provider_version_number . nil? ? line : line . sort_by ( & :provider_version_order ) . last } . flatten end
rubocop: disable Metrics/CyclomaticComplexity
It would be nicer to do this in the SQL, but it requires time that I don't have at the moment
rubocop : disable Metrics / CyclomaticComplexity It would be nicer to do this in the SQL but it requires time that I don ' t have at the moment
# The group with the nil provider_version_numbers will be the results of the left outer join # that don't have verifications, so we need to include them all.
options
lines