Skip to content

Commit

Permalink
Create graphs of bug closing statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
tillea committed Dec 18, 2011
1 parent 8286e25 commit 1593c53
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
1 change: 1 addition & 0 deletions bug_close_history.py
28 changes: 20 additions & 8 deletions upload_history.py
Expand Up @@ -76,11 +76,23 @@ def RowDictionaries(cursor):
result.append(resultrow)
return result

if argv[0].endswith('upload_history.py'):
sql_procedure_prefix = 'active_uploader'
outputname = 'uploaders'
print "Calculate uploaders history"
elif argv[0].endswith('bug_close_history.py'):
sql_procedure_prefix = 'bug_closer'
outputname = 'bugs'
print "Calculate bug closing history"
else:
print >>stderr, "Unexpected script name %s" % argv[0]
exit(1)

for team in teams.keys():
# print team
datafile='uploaders_'+team+'.txt'
datafile=outputname+'_'+team+'.txt'
out = open(datafile, 'w')
query = "SELECT replace(uploader,' ','_') AS uploader FROM active_uploader_names_of_pkggroup('%s', %i) AS (uploader text);" % (teams[team], MAXUPLOADERS)
query = "SELECT replace(uploader,' ','_') AS uploader FROM %s_names_of_pkggroup('%s', %i) AS (uploader text);" % (sql_procedure_prefix, teams[team], MAXUPLOADERS)
# print query
curs.execute(query)

Expand All @@ -101,10 +113,10 @@ def RowDictionaries(cursor):
FROM
crosstab(
'SELECT year AS row_name, name AS bucket, count AS value
FROM active_uploader_per_year_of_pkggroup(''%s'', %i) AS (name text, year int, count int)',
'SELECT * FROM active_uploader_names_of_pkggroup(''%s'', %i) AS (category text)'
FROM %s_per_year_of_pkggroup(''%s'', %i) AS (name text, year int, count int)',
'SELECT * FROM %s_names_of_pkggroup(''%s'', %i) AS (category text)'
) As (%s)
""" % (teams[team], nuploaders, teams[team], MAXUPLOADERS, typestring)
""" % (sql_procedure_prefix, teams[team], nuploaders, sql_procedure_prefix, teams[team], MAXUPLOADERS, typestring)

try:
# print query
Expand All @@ -129,10 +141,10 @@ def RowDictionaries(cursor):
FROM
crosstab(
'SELECT year AS row_name, name AS bucket, count AS value
FROM active_uploader_per_year_of_pkggroup(''%s'', %i) AS (name text, year int, count int)',
'SELECT * FROM active_uploader_names_of_pkggroup(''%s'', %i) AS (category text)'
FROM %s_per_year_of_pkggroup(''%s'', %i) AS (name text, year int, count int)',
'SELECT * FROM %s_names_of_pkggroup(''%s'', %i) AS (category text)'
) As (%s)
""" % (teams[team], nuploaders, teams[team], nuploaders, typestring)
""" % (sql_procedure_prefix, teams[team], nuploaders, sql_procedure_prefix, teams[team], nuploaders, typestring)
# print query
conn.rollback()
curs.execute(query)
Expand Down

0 comments on commit 1593c53

Please sign in to comment.