bin/pull_req_data_extraction.rb
def merger_team(pr, months_back)
    recently_merged = prs.find_all do |b|
      close_reason[b[:github_id]][1] != :unknown and
          b[:created_at].to_i > (pr[:created_at].to_i - months_back * 30 * 24 * 3600)
    end.map do |b|
      b[:github_id]
    end

    q = <<-QUERY
    select u1.login as merger
    from users u, projects p, pull_requests pr, pull_request_history prh, users u1
    where prh.action = 'closed'
      and prh.actor_id = u1.id
      and prh.pull_request_id = pr.id
      and pr.base_repo_id = p.id
      and p.owner_id = u.id
      and u.login = ?
      and p.name = ?
      and pr.pullreq_id = ?
    QUERY

    recently_merged.map do |pr_num|
      a = db.fetch(q, pr[:login], pr[:project_name], pr_num).first
      if not a.nil? then a[:merger] else nil end
    end.select {|x| not x.nil?}.uniq

  end
# People that merged (not necessarily through pull requests) up to months_back
# from the time the built PR was created.
People that merged (not necessarily through pull requests) up to months_back
from the time the built PR was created.
People that merged ( not necessarily through pull requests ) up to months_back from the time the built PR was created .
def merger_team(pr, months_back)
    recently_merged = prs.find_all do |b|
      close_reason[b[:github_id]][1] != :unknown and
          b[:created_at].to_i > (pr[:created_at].to_i - months_back * 30 * 24 * 3600)
    end.map do |b|
      b[:github_id]
    end
    q = <<-QUERY
    select u1.login as merger
    from users u, projects p, pull_requests pr, pull_request_history prh, users u1
    where prh.action = 'closed'
      and prh.actor_id = u1.id
      and prh.pull_request_id = pr.id
      and pr.base_repo_id = p.id
      and p.owner_id = u.id
      and u.login = ?
      and p.name = ?
      and pr.pullreq_id = ?
    QUERY
    recently_merged.map do |pr_num|
      a = db.fetch(q, pr[:login], pr[:project_name], pr_num).first
      if not a.nil? then a[:merger] else nil end
    end.select {|x| not x.nil?}.uniq
  end
def merger_team ( pr , months_back ) recently_merged = prs . find_all do | b | close_reason [ b [ :github_id ] ] [ 1 ] != :unknown and b [ :created_at ] . to_i > ( pr [ :created_at ] . to_i - months_back * 30 * 24 * 3600 ) end . map do | b | b [ :github_id ] end q = <<-QUERY 
    select u1.login as merger
    from users u, projects p, pull_requests pr, pull_request_history prh, users u1
    where prh.action = 'closed'
      and prh.actor_id = u1.id
      and prh.pull_request_id = pr.id
      and pr.base_repo_id = p.id
      and p.owner_id = u.id
      and u.login = ?
      and p.name = ?
      and pr.pullreq_id = ?
     QUERY recently_merged . map do | pr_num | a = db . fetch ( q , pr [ :login ] , pr [ :project_name ] , pr_num ) . first if not a . nil? then a [ :merger ] else nil end end . select { | x | not x . nil? } . uniq end
People that merged (not necessarily through pull requests) up to months_back
from the time the built PR was created.
People that merged ( not necessarily through pull requests ) up to months_back from the time the built PR was created .
pr
months_back