def GetQueryPeopleMediaWiki (developer_id, period, startdate, enddate, evol) : fields = "COUNT(wiki_pages_revs.id) AS revisions" tables = GetTablesOwnUniqueIdsMediaWiki() filters = GetFiltersOwnUniqueIdsMediaWiki() + " AND pup.uuid = '" + str(developer_id) + "'" if (evol) : q = GetSQLPeriod(period,'date', fields, tables, filters, startdate, enddate) else : fields += ",DATE_FORMAT (min(date),'%Y-%m-%d') as first_date, "+\ "DATE_FORMAT (max(date),'%Y-%m-%d') as last_date" q = GetSQLGlobal('date', fields, tables, filters, startdate, enddate) return (q)
def GetPeopleQuerySCRSubmissions (developer_id, period, startdate, enddate, evol): fields = "COUNT(i.id) AS submissions" tables = GetTablesOwnUniqueIdsSCR('issues') filters = GetFiltersOwnUniqueIdsSCR('issues')+ " AND pup.uuid = '"+ str(developer_id) +"'" if (evol): q = GetSQLPeriod(period,'submitted_on', fields, tables, filters, startdate, enddate) else: fields = fields + \ ",DATE_FORMAT (min(submitted_on),'%Y-%m-%d') as first_date, "+\ " DATE_FORMAT (max(submitted_on),'%Y-%m-%d') as last_date" q = GetSQLGlobal('submitted_on', fields, tables, filters, startdate, enddate) return (q)
def GetPeopleQuerySCRChanges (developer_id, period, startdate, enddate, evol): fields = "COUNT(c.id) AS changes" tables = GetTablesOwnUniqueIdsSCR() filters = GetFiltersOwnUniqueIdsSCR()+ " AND pup.uuid = '"+ str(developer_id) + "'" if (evol): q = GetSQLPeriod(period,'changed_on', fields, tables, filters, startdate, enddate) else: fields = fields + \ ",DATE_FORMAT (min(changed_on),'%Y-%m-%d') as first_date, "+\ " DATE_FORMAT (max(changed_on),'%Y-%m-%d') as last_date" q = GetSQLGlobal('changed_on', fields, tables, filters, startdate, enddate) return (q)
def GetPeopleQuerySCM(developer_id, period, startdate, enddate, evol): fields = 'COUNT(distinct(s.id)) AS commits' tables = GetTablesOwnUniqueIdsSCM() filters = GetFiltersOwnUniqueIdsSCM() filters += " AND pup.uuid='" + str(developer_id) + "'" if (evol): q = GetSQLPeriod(period, 's.author_date', fields, tables, filters, startdate, enddate) else: fields += ",DATE_FORMAT (min(s.author_date),'%Y-%m-%d') as first_date, "+\ "DATE_FORMAT (max(s.author_date),'%Y-%m-%d') as last_date" q = GetSQLGlobal('s.author_date', fields, tables, filters, startdate, enddate) return (q)
def GetQueryPeopleIRC(developer_id, period, startdate, enddate, evol): fields = "COUNT(irclog.id) AS sent" tables = GetTablesOwnUniqueIdsIRC() filters = GetFiltersOwnUniqueIdsIRC() + " AND pup.uuid = '" + str( developer_id) + "'" filters += " AND irclog.type='COMMENT'" if (evol): q = GetSQLPeriod(period, 'date', fields, tables, filters, startdate, enddate) else: fields = fields + \ ",DATE_FORMAT (min(date),'%Y-%m-%d') as first_date,"+\ " DATE_FORMAT (max(date),'%Y-%m-%d') as last_date" q = GetSQLGlobal('date', fields, tables, filters, startdate, enddate) return (q)
def GetQueryPeopleMLS(developer_id, period, startdate, enddate, evol): fields = "COUNT(m.message_ID) AS sent" tables = GetTablesOwnUniqueIdsMLS() filters = GetFiltersOwnUniqueIdsMLS() + "AND pup.uuid = '" + str( developer_id) + "'" if (evol): q = GetSQLPeriod(period, 'first_date', fields, tables, filters, startdate, enddate) else: fields = fields +\ ",DATE_FORMAT (min(first_date),'%Y-%m-%d') as first_date, "+\ "DATE_FORMAT (max(first_date),'%Y-%m-%d') as last_date" q = GetSQLGlobal('first_date', fields, tables, filters, startdate, enddate) return (q)
def GetPeopleQueryITS (developer_id, period, startdate, enddate, evol, closed_condition) : fields = " COUNT(distinct(c.issue_id)) AS closed" tables = GetTablesOwnUniqueIdsITS() filters = GetFiltersOwnUniqueIdsITS() + " AND pup.uuid = '"+ str(developer_id)+"'" filters += " AND "+ closed_condition if (evol) : q = GetSQLPeriod(period,'changed_on', fields, tables, filters, startdate, enddate) else : fields += ",DATE_FORMAT (min(changed_on),'%Y-%m-%d') as first_date, "+\ "DATE_FORMAT (max(changed_on),'%Y-%m-%d') as last_date" q = GetSQLGlobal('changed_on', fields, tables, filters, startdate, enddate) return (q)
def GetPeopleQuerySCR (developer_id, period, startdate, enddate, evol): fields = "COUNT(c.id) AS closed" tables = GetTablesOwnUniqueIdsSCR() filters = GetFiltersOwnUniqueIdsSCR()+ " AND pup.uuid = '"+ str(developer_id) + "'" # Just closed, not all changes filters += "AND (new_value='MERGED' OR new_value='ABANDONED')" if (evol): q = GetSQLPeriod(period,'changed_on', fields, tables, filters, startdate, enddate) else: fields = fields + \ ",DATE_FORMAT (min(changed_on),'%Y-%m-%d') as first_date, "+\ " DATE_FORMAT (max(changed_on),'%Y-%m-%d') as last_date" q = GetSQLGlobal('changed_on', fields, tables, filters, startdate, enddate) return (q)
def get_people_query(developer_id, startdate, enddate, evol=False, period=None): query_builder = Pullpo.get_query_builder() fields = 'COUNT(distinct(pr.id)) AS submissions' tables = 'pull_requests pr, people_uidentities pup' filters = 'pr.user_id = pup.people_id' filters += " AND pup.uuid='" + str(developer_id) + "'" if (evol): q = GetSQLPeriod(period, 'pr.created_at', fields, tables, filters, startdate, enddate) else: fields += ",DATE_FORMAT (min(pr.created_at),'%Y-%m-%d') as first_date, "+\ "DATE_FORMAT (max(pr.created_at),'%Y-%m-%d') as last_date" q = GetSQLGlobal('pr.created_at', fields, tables, filters, startdate, enddate) data = ExecuteQuery(q) return (data)