summaryrefslogtreecommitdiff
path: root/apps/patchmetrics/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'apps/patchmetrics/views.py')
-rw-r--r--apps/patchmetrics/views.py22
1 files changed, 6 insertions, 16 deletions
diff --git a/apps/patchmetrics/views.py b/apps/patchmetrics/views.py
index 123af9c..c6b62fb 100644
--- a/apps/patchmetrics/views.py
+++ b/apps/patchmetrics/views.py
@@ -15,7 +15,6 @@ from patchmetrics.models import (
get_number_of_patches_accepted,
get_number_of_patches_waiting_for_feedback,
get_patches_accepted_by_age_range,
- get_patches_per_month_up_to,
get_patches_waiting_for_feedback_by_age_range,
get_oldest_patches_waiting_for_feedback,
patch_count_by_month,
@@ -107,23 +106,14 @@ def team_user(request, team_id, user):
def overall_teams_report(request):
context = PatchworkRequestContext(request)
- one_month_ago = datetime.now() - relativedelta.relativedelta(months=1)
teams_data = []
- months = []
for team in Team.objects.all().order_by('display_name'):
- submitted, accepted = get_patches_per_month_up_to(
- one_month_ago.year, one_month_ago.month, team.get_patch_count,
- limit=8)
- if len(months) == 0:
- for item in submitted:
- # The timestamps returned by get_patches_per_month_up_to() are
- # in milliseconds so we need to divide them by 1000 here.
- month = datetime.utcfromtimestamp(item[0] / 1000).month
- months.append(calendar.month_name[month])
- submitted = [item[1] for item in submitted]
- accepted = [item[1] for item in accepted]
- counts = zip(submitted, accepted)
- teams_data.append([team, counts])
+ teams_data.append((team, patch_month_metrics(team.patches)))
+ months = []
+ for x in teams_data[0][1]:
+ # go from ms to "month"
+ month = datetime.utcfromtimestamp(x[0] / 1000).month
+ months.append(calendar.month_name[month])
context['teams_data'] = teams_data
context['months'] = months
return render_to_response('patchmetrics/teams.html', context)