Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 75 lines (69 sloc) 3.407 kb
8286e25 Andreas Tille Create all needed functions for bug closing statistics
tillea authored
1 -- top 10 maintainers as carnivore ID
2 CREATE OR REPLACE FUNCTION bug_closer_ids_of_pkggroup(text,int) RETURNS SETOF RECORD AS $$
3 SELECT ce.id
4 , COUNT(*)::int
5 FROM (SELECT id, source, done_email FROM archived_bugs
6 UNION
7 SELECT id, source, done_email FROM bugs WHERE status = 'done'
8 ) db
9 JOIN carnivore_emails ce ON ce.email = db.done_email
10 WHERE source IN ( -- source packages that are maintained by the team
11 SELECT DISTINCT source FROM upload_history
12 WHERE maintainer_email = $1
13 AND nmu = 'f'
14 )
15 AND done_email IN ( -- email of uploaders who at least once uploaded on behalf of the team
16 SELECT DISTINCT ce.email FROM upload_history uh
17 JOIN carnivore_emails ce ON ce.email = uh.changed_by_email
18 WHERE maintainer_email = $1
19 AND nmu = 'f'
20 )
21 GROUP BY ce.id
22 ORDER BY count DESC
23 LIMIT $2
24 $$ LANGUAGE 'SQL';
25
26 /*
27 SELECT * FROM bug_closer_ids_of_pkggroup('debian-med-packaging@lists.alioth.debian.org',50) AS (id int, count int);
28 SELECT * FROM bug_closer_ids_of_pkggroup('debian-science-maintainers@lists.alioth.debian.org',50) AS (id int, count int);
29 */
30
fb83326 Andreas Tille Function bug_closer_per_year_of_pkggroup is new (other functions need to...
tillea authored
31 -- top 10 maintainers closing bugs in team packages
32 CREATE OR REPLACE FUNCTION bug_closer_per_year_of_pkggroup(text,int) RETURNS SETOF RECORD AS $$
8286e25 Andreas Tille Create all needed functions for bug closing statistics
tillea authored
33 SELECT cn.name, db.year, COUNT(*)::int FROM
fb83326 Andreas Tille Function bug_closer_per_year_of_pkggroup is new (other functions need to...
tillea authored
34 -- (SELECT source, EXTRACT(year FROM done_date)::int AS year, done_email -- done_date is always 1970-01-01
35 (SELECT id, source, EXTRACT(year FROM last_modified)::int AS year, done_email FROM archived_bugs
36 UNION
37 SELECT id, source, EXTRACT(year FROM last_modified)::int AS year, done_email FROM bugs WHERE status = 'done'
8286e25 Andreas Tille Create all needed functions for bug closing statistics
tillea authored
38 ) db
39 JOIN carnivore_emails ce ON ce.email = db.done_email
fb83326 Andreas Tille Function bug_closer_per_year_of_pkggroup is new (other functions need to...
tillea authored
40 JOIN (SELECT * FROM carnivore_names
8286e25 Andreas Tille Create all needed functions for bug closing statistics
tillea authored
41 WHERE id IN (SELECT idupl FROM bug_closer_ids_of_pkggroup($1, $2) AS (idupl int, count int))
fb83326 Andreas Tille Function bug_closer_per_year_of_pkggroup is new (other functions need to...
tillea authored
42 ) cn ON ce.id = cn.id
43 JOIN carnivore_names_prefered cnp ON cn.id = cnp.id
44 WHERE source IN ( -- source packages that are maintained by the team
45 SELECT DISTINCT source FROM upload_history
46 WHERE maintainer_email = $1
47 AND nmu = 'f'
48 )
49 AND done_email IN ( -- email of uploaders who at least once uploaded on behalf of the team
50 SELECT DISTINCT ce.email FROM upload_history uh
51 JOIN carnivore_emails ce ON ce.email = uh.changed_by_email
52 WHERE maintainer_email = $1
53 )
54 AND cn.name = cnp.name
8286e25 Andreas Tille Create all needed functions for bug closing statistics
tillea authored
55 GROUP BY cn.name, db.year
fb83326 Andreas Tille Function bug_closer_per_year_of_pkggroup is new (other functions need to...
tillea authored
56 ORDER BY year, count DESC, cn.name
57 $$ LANGUAGE 'SQL';
58
59 /*
60 SELECT * FROM bug_closer_per_year_of_pkggroup('debian-med-packaging@lists.alioth.debian.org',50) AS (name text, year int, count int);
61 SELECT * FROM bug_closer_per_year_of_pkggroup('debian-science-maintainers@lists.alioth.debian.org',50) AS (name text, year int, count int);
62 */
63
64 -- top 10 maintainers as (hopefully!!!) unique name
8286e25 Andreas Tille Create all needed functions for bug closing statistics
tillea authored
65 CREATE OR REPLACE FUNCTION bug_closer_names_of_pkggroup(text, int) RETURNS SETOF RECORD AS $$
fb83326 Andreas Tille Function bug_closer_per_year_of_pkggroup is new (other functions need to...
tillea authored
66 SELECT cnp.name FROM
8286e25 Andreas Tille Create all needed functions for bug closing statistics
tillea authored
67 (SELECT id FROM bug_closer_ids_of_pkggroup($1, $2) AS (id int, count int)) au
fb83326 Andreas Tille Function bug_closer_per_year_of_pkggroup is new (other functions need to...
tillea authored
68 JOIN carnivore_names_prefered cnp ON au.id = cnp.id
69 $$ LANGUAGE 'SQL';
70
71 /*
8286e25 Andreas Tille Create all needed functions for bug closing statistics
tillea authored
72 SELECT * FROM bug_closer_names_of_pkggroup('debian-med-packaging@lists.alioth.debian.org',50) AS (name text);
73 SELECT * FROM bug_closer_names_of_pkggroup('debian-science-maintainers@lists.alioth.debian.org',50) AS (name text);
fb83326 Andreas Tille Function bug_closer_per_year_of_pkggroup is new (other functions need to...
tillea authored
74 */
Something went wrong with that request. Please try again.