Sha256: 72d56c3ee448463314da3448833ddccb7acff05383666647b90eab5ed1475aad
Contents?: true
Size: 908 Bytes
Versions: 40
Compression:
Stored size: 908 Bytes
Contents
module PactBroker module Versions module EagerLoaders class LatestVersionForPacticipant def self.call(eo, **_other) populate_associations(eo[:rows]) end def self.populate_associations(versions) group_by_pacticipant(versions).each do | pacticipant, participant_versions | populate_associations_by_pacticipant(pacticipant, participant_versions) end end def self.group_by_pacticipant(versions) versions.to_a.group_by(&:pacticipant) end def self.populate_associations_by_pacticipant(pacticipant, versions) latest_version = versions.first.class.latest_version_for_pacticipant(pacticipant).single_record versions.each do | version | version.associations[:latest_version_for_pacticipant] = latest_version end end end end end end
Version data entries
40 entries across 40 versions & 1 rubygems