class Api::V1::Projects::DevelopersController < Api::V1::BaseController
  def index
    @query_result = ActiveRecord::Base.connection.select_all("select user_id, count(*), count(DISTINCT project_id), (select count(1) from issues where issues.author_id = commit_logs.user_id) as issues_count from commit_logs group by user_id")
    @rows = kaminari_array_paginate(@query_result.rows)
  end

  def count
    @query_result = ActiveRecord::Base.connection.select_all("select user_id, count(*), count(DISTINCT project_id), (select count(1) from issues where issues.author_id = commit_logs.user_id) as issues_count from commit_logs group by user_id")
    render_ok({count: @query_result.rows.count})
  end
end