bin/pull_req_data_extraction.rb
# Person that first closed the pull request
Person that first closed the pull request
Person that first closed the pull request
def closer(pr)
    q = <<-QUERY
    select u.login as login
    from pull_request_history prh, users u
    where prh.pull_request_id = ?
      and prh.actor_id = u.id
      and prh.action = 'closed'
    QUERY
    closer = db.fetch(q, pr[:id]).first
    if closer.nil?
      q = <<-QUERY
      select u.login as login
      from issues i, issue_events ie, users u
      where i.pull_request_id = ?
        and ie.issue_id = i.id
        and (ie.action = 'closed' or ie.action = 'merged')
        and u.id = ie.actor_id
      QUERY
      closer = db.fetch(q, pr[:id]).first
    end
    unless closer.nil?
      closer[:login]
    else
      nil
    end
  end
def closer ( pr ) q = <<-QUERY 
    select u.login as login
    from pull_request_history prh, users u
    where prh.pull_request_id = ?
      and prh.actor_id = u.id
      and prh.action = 'closed'
     QUERY closer = db . fetch ( q , pr [ :id ] ) . first if closer . nil? q = <<-QUERY 
      select u.login as login
      from issues i, issue_events ie, users u
      where i.pull_request_id = ?
        and ie.issue_id = i.id
        and (ie.action = 'closed' or ie.action = 'merged')
        and u.id = ie.actor_id
       QUERY closer = db . fetch ( q , pr [ :id ] ) . first end unless closer . nil? closer [ :login ] else nil end end
Person that first closed the pull request
Person that first closed the pull request
pr