summaryrefslogtreecommitdiff
path: root/linaro_metrics/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'linaro_metrics/views.py')
-rw-r--r--linaro_metrics/views.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/linaro_metrics/views.py b/linaro_metrics/views.py
index 78f5949..308894f 100644
--- a/linaro_metrics/views.py
+++ b/linaro_metrics/views.py
@@ -8,6 +8,7 @@ import django.template.base
from django.conf import settings
from django.contrib.auth.models import User
from django.core.cache import cache
+from django.http import StreamingHttpResponse
from django.shortcuts import get_object_or_404, redirect, render
from django.utils.html import format_html
@@ -18,6 +19,7 @@ from patchwork.templatetags.person import personify
from patchwork.templatetags.project import project_tags
from linaro_metrics.models import (
+ ProjectTagCredit,
Team,
TeamCredit,
TeamMembership,
@@ -232,6 +234,42 @@ def report_project_activity(request):
request, 'linaro_metrics/report_project_activity.html', context)
+def _signed_off_iterator(request):
+ yield '# This can take query arguments: start=YYYY-MM and end=YYYY-MM\n'
+ qs = ProjectTagCredit.objects
+ start = request.GET.get('start')
+ if start:
+ yield '# Querying with date > %s\n' % start
+ yyyy, mm = start.split('-')
+ start = datetime.datetime(int(yyyy), int(mm), 1)
+ qs = qs.filter(commit_tag__date__gt=start)
+
+ end = request.GET.get('end')
+ if end:
+ yield '# Querying with date < %s\n' % end
+ yyyy, mm = end.split('-')
+ end = datetime.datetime(int(yyyy), int(mm), 1)
+ qs = qs.filter(commit_tag__date__lt=end)
+ qs = qs.filter(
+ commit_tag__non_author=True,
+ commit_tag__tag='Signed-off'
+ ).distinct(
+ 'commit_tag__tag',
+ 'commit_tag__commit',
+ 'commit_tag__person'
+ )
+ for c in qs:
+ yield '%s,\t%s,\t%s,\t%s\n' % (
+ c.project.name, c.commit_tag.tag, c.commit_tag.commit,
+ c.commit_tag.person.name)
+
+
+def report_signed_off_non_author(request):
+ response = StreamingHttpResponse(
+ _signed_off_iterator(request), content_type="text/csv")
+ return response
+
+
def old_patch_link(request, patch):
patch = int(patch)
if patch > 55493: