Skip to content

Extend Ci::RunnersFinder to allow grouping of results

This MR is a follow-up from !74196 (comment 733252872) to resolve a Rubocop issue where the group ActiveRecord method is being called from a helper class, instead of from the finder.

We should:

  • Create a RunnersFinder#execute_and_group method to group the results

The following discussion from !74196 (merged) should be addressed:

  • @furkanayhan started a discussion: (+6 comments)

    This requires 4 SQL queries for each call.

    We can also do something like;

    # just a draft...
    @runner_type_counts ||= Ci::RunnersFinder.new(current_user: current_user, params: {}).execute.except(:limit, :offset, :order).group(:runner_type).count
    @runner_type_counts[type]