Merge lp:~andrewsomething/dat-overview/graphs-first-cut into lp:dat-overview

Proposed by Andrew Starr-Bochicchio on 2013-07-02
Status: Merged
Merged at revision: 33
Proposed branch: lp:~andrewsomething/dat-overview/graphs-first-cut
Merge into: lp:dat-overview
Diff against target: 242 lines (+152/-11)
7 files modified
overview/templates/base.html (+1/-7)
overview/templates/contributors_per_release.html (+50/-0)
overview/templates/index.html (+2/-2)
overview/templates/sidebar.html (+4/-1)
overview/templates/uploads_per_release.html (+58/-0)
overview/uploads/views.py (+31/-0)
overview/urls.py (+6/-1)
To merge this branch: bzr merge lp:~andrewsomething/dat-overview/graphs-first-cut
Reviewer Review Type Date Requested Status
Daniel Holbach 2013-07-02 Approve on 2013-07-08
Review via email: mp+172684@code.launchpad.net

Description of the change

First cut at providing some interesting graphs. This has the two most obvious ones:
uploads per release and contributors per release.

To post a comment you must log in.
37. By Andrew Starr-Bochicchio on 2013-07-02

Make clear that 'syncs' in the uploads per release graph are auto-syncs.

Daniel Holbach (dholbach) wrote :

Great work!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'overview/templates/base.html'
2--- overview/templates/base.html 2013-06-18 23:57:17 +0000
3+++ overview/templates/base.html 2013-07-02 21:56:32 +0000
4@@ -63,17 +63,11 @@
5
6 <div id="content" class="container row-fluid">
7
8-{% if in_allowed_group %}
9 <div class="offset1 span8">
10-{% else %}
11- <div class="offset1 span10">
12-{% endif %}
13 {% block content %}{% endblock %}
14 </div>
15
16-{% if in_allowed_group %}
17- {% include "sidebar.html" %}
18-{% endif %}
19+ {% include "sidebar.html" %}
20
21 </div>
22
23
24=== added file 'overview/templates/contributors_per_release.html'
25--- overview/templates/contributors_per_release.html 1970-01-01 00:00:00 +0000
26+++ overview/templates/contributors_per_release.html 2013-07-02 21:56:32 +0000
27@@ -0,0 +1,50 @@
28+{% extends "base.html" %}
29+{% load custom_tags %}
30+
31+{% block extrahead %}
32+
33+ <script type="text/javascript" src="https://www.google.com/jsapi"></script>
34+ <script type="text/javascript">
35+
36+ google.load('visualization', '1.0', {'packages':['corechart']});
37+
38+ google.setOnLoadCallback(drawChart);
39+
40+ function drawChart() {
41+
42+ var data = new google.visualization.DataTable();
43+ data.addColumn('string', 'Release');
44+ data.addColumn('number', 'New Contributors');
45+ data.addColumn('number', 'Contributors');
46+ data.addRows([
47+ {% for field, value in contribs_per_release.items %}
48+ ['{{ field }}', {% for v in value %}
49+ {{ v }},
50+ {% endfor %}],
51+ {% endfor %}
52+ ]);
53+
54+ var options = {'width':775,
55+ 'height':700,
56+ isStacked: true,
57+ colors: ['#dd4814', '#F8C300', '#772953', '#D70A53']};
58+ var chart = new google.visualization.ColumnChart(document.getElementById('contribs_per_release'));
59+ chart.draw(data, options);
60+ }
61+ </script>
62+
63+{% endblock %}
64+
65+{% block content %}
66+
67+<h2>Contributors per release:</h2>
68+
69+<div class='main'>
70+
71+ <div id='contribs_per_release'>
72+ <div id="contribs_per_release"></div>
73+ </div>
74+
75+</div>
76+
77+{% endblock %}
78
79=== modified file 'overview/templates/index.html'
80--- overview/templates/index.html 2013-06-12 18:37:58 +0000
81+++ overview/templates/index.html 2013-07-02 21:56:32 +0000
82@@ -16,8 +16,8 @@
83 <li>Reach out to people who might be ready to apply for upload rights and help them.</li>
84 <li>Reach out to contributors that went inactive and get feedback from them and offer help.</li>
85 <br>
86- <p>Currently you must be a member of the team to use the DAT Overview.
87- In the future, we hope to provide publicly viewable anonymized data that
88+ <p>To view most of the tools on this site, you must be a member of the
89+ team. Though, we do provide some publicly viewable anonymized data that
90 helps give a picture of the Ubuntu contributor community.</p>
91 <br>
92 <div id="link_btn"><a href="openid/login">Login Using Ubuntu SSO</a></div>
93
94=== modified file 'overview/templates/sidebar.html'
95--- overview/templates/sidebar.html 2013-06-12 16:09:37 +0000
96+++ overview/templates/sidebar.html 2013-07-02 21:56:32 +0000
97@@ -6,6 +6,7 @@
98
99 <div class="main">
100
101+{% if in_allowed_group %}
102 <h3>Contributors:</h3>
103
104 <ul>
105@@ -14,11 +15,13 @@
106 <li><a href="/contributors/lost_contributors.html">Lost contributors</a></li>
107 <li><a href="/contributors/potential_devs.html">Potential Ubuntu Developers</a></li>
108 </ul>
109+{% endif %}
110
111 <h3>Stats:</h3>
112
113 <ul>
114- <li>Comming soon...</li>
115+ <li><a href="/stats/uploads_per_release.html">Uploads per release</a></li>
116+ <li><a href="/stats/contributors_per_release.html">Contributors per release</a></li>
117 </ul>
118
119 </div>
120
121=== added file 'overview/templates/uploads_per_release.html'
122--- overview/templates/uploads_per_release.html 1970-01-01 00:00:00 +0000
123+++ overview/templates/uploads_per_release.html 2013-07-02 21:56:32 +0000
124@@ -0,0 +1,58 @@
125+{% extends "base.html" %}
126+{% load custom_tags %}
127+
128+{% block extrahead %}
129+
130+ <script type="text/javascript" src="https://www.google.com/jsapi"></script>
131+ <script type="text/javascript">
132+
133+ google.load('visualization', '1.0', {'packages':['corechart']});
134+
135+ google.setOnLoadCallback(drawChart);
136+
137+ function drawChart() {
138+
139+ var data = new google.visualization.DataTable();
140+ data.addColumn('string', 'Release');
141+ data.addColumn('number', 'Developer');
142+ data.addColumn('number', 'Sponsored');
143+ data.addColumn('number', 'Robots');
144+ data.addColumn('number', 'Auto-Syncs');
145+ data.addRows([
146+ {% for field, value in uploads_per_release.items %}
147+ ['{{ field }}', {% for v in value %}
148+ {{ v }},
149+ {% endfor %}],
150+ {% endfor %}
151+ ]);
152+
153+ var options = {'width':775,
154+ 'height':700,
155+ isStacked: true,
156+ colors: ['#dd4814', '#F8C300', '#772953', '#D70A53']};
157+ var chart = new google.visualization.ColumnChart(document.getElementById('uploads_per_release_chart'));
158+ chart.draw(data, options);
159+ }
160+ </script>
161+
162+{% endblock %}
163+
164+{% block content %}
165+
166+<h2>Uploads per release:</h2>
167+
168+<div class='main'>
169+
170+ <div id='uploads_per_release'>
171+ <div id="uploads_per_release_chart"></div>
172+ </div>
173+
174+ <p><b>Note:</b>
175+ <i><ul>
176+ <li>"Robots" are 'ps-jenkins', 'ubuntu-langpack', and 'kubuntu-members'</li>
177+ <li>"Auto-Syncs" are uploads performed by 'katie.'</li>
178+ </ul></i></p>
179+
180+</div>
181+
182+{% endblock %}
183
184=== modified file 'overview/uploads/views.py'
185--- overview/uploads/views.py 2013-06-23 19:40:02 +0000
186+++ overview/uploads/views.py 2013-07-02 21:56:32 +0000
187@@ -189,6 +189,37 @@
188 edited_contribs})
189
190
191+def uploads_per_release(request):
192+ uploads_per_release = OrderedDict([])
193+ for d in UbuntuDistroInfo().all:
194+ r_uploads = Uploads.objects.filter(release__icontains=d)
195+ syncs = r_uploads.filter(lpid_changer='katie').count()
196+ robots = ['ps-jenkins', 'ubuntu-langpack', 'kubuntu-members']
197+ robot_uploads = r_uploads.filter(lpid_changer__in=robots).count()
198+ blacklist = robots + ["katie"]
199+ spon_uploads = r_uploads.exclude(email_sponsor="").exclude(
200+ lpid_changer__in=blacklist).count()
201+ dev_uploads = r_uploads.filter(email_sponsor="").exclude(
202+ lpid_changer__in=blacklist).count()
203+ uploads_per_release[d] = dev_uploads, spon_uploads, robot_uploads, syncs
204+ return render(request, 'uploads_per_release.html',
205+ {'uploads_per_release': uploads_per_release})
206+
207+
208+def contribs_per_release(request):
209+ contribs_per_release = OrderedDict([])
210+ for d in UbuntuDistroInfo().all:
211+ r_new_contribs = People.objects.filter(
212+ first_upload__release__icontains=d).count()
213+ r_contribs = Uploads.objects.filter(release__icontains=d
214+ ).order_by('lpid_changer'
215+ ).distinct('lpid_changer'
216+ ).count() - r_new_contribs
217+ contribs_per_release[d] = r_new_contribs, r_contribs
218+ return render(request, 'contributors_per_release.html',
219+ {'contribs_per_release': contribs_per_release})
220+
221+
222 def site_logout(request):
223 logout(request)
224 messages.success(request, 'Logged out successfully...')
225
226=== modified file 'overview/urls.py'
227--- overview/urls.py 2013-06-21 21:41:27 +0000
228+++ overview/urls.py 2013-07-02 21:56:32 +0000
229@@ -27,7 +27,12 @@
230 name='lost_contributors'),
231 url(r'^contributors/potential_devs', views.potential_devs,
232 name='potential_devs'),
233- url(r'^contributors/(?P<lpid>.+)/edit', views.edit_person, name='edit_person'),
234+ url(r'^contributors/(?P<lpid>.+)/edit', views.edit_person,
235+ name='edit_person'),
236+ url(r'^stats/uploads_per_release', views.uploads_per_release,
237+ name='uploads_per_release'),
238+ url(r'^stats/contributors_per_release', views.contribs_per_release,
239+ name='contribs_per_release'),
240 url(r'^contributors/(?P<lpid>.+)', views.person_detail, name='person_detail'),
241 url(r'^users/(?P<user>.+)', views.user_profile, name='user_profile'),
242 url(r'^comments/', include('django.contrib.comments.urls'))

Subscribers

People subscribed via source and target branches