Skip to content

Paginate contribution analytics GraphQL query

What does this MR do and why?

Fixes issue discovered in !110244 (merged) by making the GraphQL query recursive, thus fetching the entire dataset rather than just the first 100 users.

How to set up and validate locally

  1. Visit any group contribution analytics page such as http://gdk.test:3000/groups/toolbox/-/contribution_analytics
  2. Feature.enable(:contribution_analytics_graphql, Group.find(GROUP_ID))
  3. Validate that the entire dataset has been rendered (should be more than 100 users) in the "Contributions per group member" table at the bottom of the page

Setting up analytics data

To ensure that the entire dataset is being paginated through until the end, you'll need to create more than 100 users, add them to a group and create issues for each. You can do so by entering the following in a Rails console:

group = Group.find(GROUP_ID)
project = group.all_projects.first
300.times { FactoryBot.create(:user).tap { |u| group.add_developer(u); Issues::CreateService.new(container: project, spam_params: nil, current_user: u, params: {title: 'title', description: 'description'}).execute }  }

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #376001 (closed)

Edited by Rudy Crespo

Merge request reports

Loading