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

Contents of /udd/web/cgi-bin/sponsorstats.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1549 - (show annotations) (download)
Thu Jul 30 00:16:53 2009 UTC (3 years, 9 months ago) by lucas
File size: 1792 byte(s)
update cgis because of changes to upload-history
1 #!/usr/bin/ruby -w
2
3 require 'dbi'
4
5 puts "Content-type: text/html\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 sth.execute
18 names = {}
19 uploaders = {}
20 uploads = {}
21 while row = sth.fetch do
22 if not uploaders.has_key?(row['login'])
23 uploaders[row['login']] = {}
24 names[row['login']] = row['key_id']
25 uploads[row['login']] = 0
26 end
27 uploads[row['login']] += 1
28 if not uploaders[row['login']].has_key?(row['changed_by'])
29 uploaders[row['login']][row['changed_by']] = []
30 end
31 uploaders[row['login']][row['changed_by']] << [ row['source'], row['version'], row['nmu'] ]
32 end
33
34 puts "<html><body>"
35 puts "<h1>Sponsoring stats, powered by UDD!</h2>"
36 puts "<p>Uploads in <b>bold</b> were NMUs.</p>"
37 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/>'
38
39 puts "<ul>"
40 uploaders.to_a.sort { |a,b| uploads[a[0]] <=> uploads[b[0]] }.reverse.each do |k|
41 k, v = k
42 puts "<li>#{k} -- #{names[k]} (#{uploads[k]} uploads)\n<ul>"
43 v.to_a.sort { |a,b| a[1].length <=> b[1].length }.reverse.each do |k2|
44 k2, v = k2
45 puts "<li>#{k2} (#{v.length} uploads)\n<ul>"
46 v.each do |u|
47 if u[2]
48 puts "<li><b>#{u[0]} #{u[1]}</b></li>"
49 else
50 puts "<li>#{u[0]} #{u[1]}</li>"
51 end
52 end
53 puts "</ul></li>"
54 end
55 puts "</ul></li>"
56 end
57 puts "</ul>"
58 sth.finish

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5