Ejemplo n.º 1
0
def get_issue_related_hour_ga(owner, project, issue, issue_id):
    result = []
    try:
        cur = connection.cursor(dictionary=True);
        cur.execute("""select created_at from issues where id = %s 
               union select created_at from issue_comments where issue_id=%s
               union select created_at from issue_events where issue_id=%s""", (issue_id,issue_id,issue_id))
        rows = cur.fetchall()
        print "issue union returned ", len(rows), " rows"
        
        for row in rows:
            for info in read_ga.getIssuePlus(owner, project, issue, row["created_at"], row["created_at"]):
                 result.append(info)
    finally:
        cur.close()

    return result
Ejemplo n.º 2
0
def get_pr_related_hour_ga(owner, project, issue, prid):
    result = []
    try:
        cur = connection.cursor(dictionary=True);
        cur.execute("""select created_at from pull_request_comments where pull_request_id = %s 
               union select created_at from pull_request_commits 
                      left join commits on pull_request_commits.commit_id=commits.id where pull_request_id=%s
               union select created_at from pull_request_history where pull_request_id=%s""", (prid,prid,prid))
        rows = cur.fetchall()
        print "pr union returned ", len(rows), " rows"
        
        for row in rows:
            for info in read_ga.getIssuePlus(owner, project, issue, row["created_at"], row["created_at"]):
                 result.append(info)
    finally:
        cur.close()

    return result
Ejemplo n.º 3
0
def get_issue_related_day_ga(owner, project, issue, issue_id):
    result = []
    try:
        cur = connection.cursor(dictionary=True);
        cur.execute("""select * from issues where id = %s""", (issue_id,))
        rows = cur.fetchall()
        
        spans = set([])
        for row in rows:
            spans.add(row["created_at"].replace(hour=0,minute=0))

        for span in spans:
            print "Checking", span, "through", span+relativedelta(days=1)
            for info in read_ga.getIssuePlus(owner, project, issue, span, span + relativedelta(days=1)):
                 print "Found in timespan: ", info["rectype"], info["time"]
                 result.append(info)

    finally:
        cur.close()

    return result