diff --git a/app/commands/track/retrieve_maintainers_status.rb b/app/commands/track/retrieve_maintainers_status.rb index 97aa920f8b..81a2b069e0 100644 --- a/app/commands/track/retrieve_maintainers_status.rb +++ b/app/commands/track/retrieve_maintainers_status.rb @@ -67,11 +67,13 @@ def track_team_members GRAPHQL response = Github::Graphql::ExecuteQuery.(query, %i[organization team childTeams]) - response[0][:nodes].filter_map do |node| - next unless track_slugs.include?(node[:name]) + response.flat_map do |nodes| + nodes[:nodes].filter_map do |node| + next unless track_slugs.include?(node[:name]) - [node[:name], node.dig(:members, :nodes).pluck(:login)] - end.to_h + [node[:name], node.dig(:members, :nodes).pluck(:login)] + end + end.sort.to_h end memoize @@ -108,7 +110,7 @@ def track_slugs = tracks.pluck(:slug) memoize def rep_cutoff_date = Time.zone.today - LAST_NUMBER_OF_MONTHS_FOR_REP.months - CACHE_KEY = "Track::RetrieveMaintainersStatus/3".freeze + CACHE_KEY = "Track::RetrieveMaintainersStatus/4".freeze CACHE_EXPIRY = 1.day.freeze private_constant :CACHE_KEY, :CACHE_EXPIRY end