/[collab-qa]/udd/web/sponsorstats.cgi
ViewVC logotype

Contents of /udd/web/sponsorstats.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1839 - (show annotations) (download)
Mon Nov 1 10:38:30 2010 UTC (2 years, 6 months ago) by lucas
File size: 2090 byte(s)
set charset to UTF-8
1 #!/usr/bin/ruby -w
2
3 require 'dbi'
4
5 puts "Content-type: text/html; charset=utf-8\n\n"
6
7 dbh = DBI::connect('DBI:Pg:dbname=udd;port=5441;host=localhost', 'guest')
8 sth = dbh.prepare("select s.source, s.version, u.changed_by, nmu, signed_by, cl.login
9 from sources s, upload_history u, carnivore_emails ce1, carnivore_emails ce2, carnivore_login cl
10 where s.distribution = 'debian' and s.release = 'sid'
11 and s.source = u.source
12 and s.version = u.version
13 and u.changed_by_email = ce1.email
14 and u.signed_by_email = ce2.email
15 and ce1.id != ce2.id
16 and ce2.id = cl.id
17 and u.changed_by_email not in (
18 select email from carnivore_emails, carnivore_login where carnivore_login.id = carnivore_emails.id)
19 ")
20 sth.execute
21 names = {}
22 uploaders = {}
23 uploads = {}
24 while row = sth.fetch do
25 if not uploaders.has_key?(row['login'])
26 uploaders[row['login']] = {}
27 names[row['login']] = row['key_id']
28 uploads[row['login']] = 0
29 end
30 uploads[row['login']] += 1
31 if not uploaders[row['login']].has_key?(row['changed_by'])
32 uploaders[row['login']][row['changed_by']] = []
33 end
34 uploaders[row['login']][row['changed_by']] << [ row['source'], row['version'], row['nmu'] ]
35 end
36
37 puts "<html><body>"
38 puts "<h1>Sponsoring stats, powered by UDD!</h1>"
39 puts "<p>Uploads in <b>bold</b> were NMUs.</p>"
40 puts "<p>That excludes uploads done for people who are now DD, even if the upload was done while they were not DD.</p>"
41 puts '<a href="http://svn.debian.org/wsvn/collab-qa/udd/web/cgi-bin/sponsorstats.cgi?op=file&rev=0&sc=0">source code</a><br/>'
42
43 puts "<ul>"
44 rank = 0
45 uploaders.to_a.sort { |a,b| uploads[a[0]] <=> uploads[b[0]] }.reverse.each do |k|
46 k, v = k
47 rank += 1
48 puts "<li>#{rank}. #{k} -- #{names[k]} (#{uploads[k]} uploads)\n<ul>"
49 v.to_a.sort { |a,b| a[1].length <=> b[1].length }.reverse.each do |k2|
50 k2, v = k2
51 puts "<li>#{k2} (#{v.length} uploads)\n<ul>"
52 v.each do |u|
53 if u[2]
54 puts "<li><b>#{u[0]} #{u[1]}</b></li>"
55 else
56 puts "<li>#{u[0]} #{u[1]}</li>"
57 end
58 end
59 puts "</ul></li>"
60 end
61 puts "</ul></li>"
62 end
63 puts "</ul>"
64 sth.finish

Properties

Name Value
svn:executable *
svn:mergeinfo

  ViewVC Help
Powered by ViewVC 1.1.5