Skip to content

Commit 248fb36

Browse files
committed
Implement “latest significant results” table and feed
This fixes tobami#171
1 parent 31a4639 commit 248fb36

5 files changed

Lines changed: 44 additions & 7 deletions

File tree

codespeed/feeds.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,14 @@ def items(self):
1212
return Report.objects.filter(
1313
revision__branch__name=settings.DEF_BRANCH
1414
).order_by('-revision__date')[:10]
15+
16+
class LatestSignificantEntries(Feed):
17+
title = settings.WEBSITE_NAME
18+
link = "/changes/"
19+
description = "Last significant benchmark runs"
20+
21+
def items(self):
22+
return Report.objects.filter(
23+
revision__branch__name=settings.DEF_BRANCH,
24+
colorcode__in = ('red','green')
25+
).order_by('-revision__date')[:10]

codespeed/static/css/main.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,10 @@ table.tablesorter, table.info, table.revision, table.reports {
285285
background-color: #fafafa;
286286
}
287287

288+
table.reports {
289+
margin-bottom: 2em
290+
}
291+
288292
/*table.reports {
289293
border-width: 2px;
290294
}*/

codespeed/templates/codespeed/reports.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,15 @@
99
</tbody>
1010
</table>
1111
{% endif %}
12+
13+
{% if significant_reports|length %}
14+
<table class="reports">
15+
<caption>Latest Significant Results <a href="feeds/latest_significant/"><img src="{{ STATIC_URL }}images/rss.png" alt="RSS feed" title="Subscribe to the significant results RSS feed" /></a></caption>
16+
<tbody>
17+
{% for report in significant_reports %} <tr class="status-{{ report.colorcode }}">
18+
<td><label title="lessisbetter" style="display:none;">{{ report.get_absolute_url }}</label>{{ report.revision }}</td><td>{{ report.executable }}@{{ report.environment}}</td>
19+
<td class="summary">{{ report.item_description }}</td>
20+
</tr>{% endfor %}
21+
</tbody>
22+
</table>
23+
{% endif %}

codespeed/urls.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
from django.core.urlresolvers import reverse
44
from django.views.generic import TemplateView
55

6-
from codespeed.feeds import LatestEntries
6+
from codespeed.feeds import *
77

8-
feeds = {'latest': LatestEntries}
98

109
urlpatterns = patterns('',
1110
(r'^$', TemplateView.as_view(template_name='home.html')),
1211
(r'^about/$', TemplateView.as_view(template_name='about.html')),
1312
# RSS for reports
14-
(r'^feeds/(?P<url>.*)/$', LatestEntries()),
13+
url(r'^feeds/latest/$', LatestEntries(), name='latest_feeds'),
14+
url(r'^feeds/latest_significant/$', LatestSignificantEntries(), name='latest_significant_feeds'),
1515
)
1616

1717
urlpatterns += patterns('codespeed.views',

codespeed/views.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -730,11 +730,21 @@ def reports(request):
730730
if request.method != 'GET':
731731
return HttpResponseNotAllowed('GET')
732732

733-
return render_to_response('codespeed/reports.html', {
734-
'reports': Report.objects.filter(
733+
context = {}
734+
735+
context['reports'] = \
736+
Report.objects.filter(
735737
revision__branch__name=settings.DEF_BRANCH
736-
).order_by('-revision__date')[:10],
737-
}, context_instance=RequestContext(request))
738+
).order_by('-revision__date')[:10]
739+
740+
context['significant_reports'] = \
741+
Report.objects.filter(
742+
revision__branch__name=settings.DEF_BRANCH,
743+
colorcode__in = ('red','green')
744+
).order_by('-revision__date')[:10]
745+
746+
return render_to_response('codespeed/reports.html',
747+
context, context_instance=RequestContext(request))
738748

739749

740750
def displaylogs(request):

0 commit comments

Comments
 (0)