Skip to content

Commit

Permalink
Added a "patches submitted" metric to the user pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobian committed Sep 15, 2011
1 parent 2d6f62b commit a0422b0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion django_website/trac/stats.py
Expand Up @@ -6,7 +6,7 @@
import operator
import django.db
from django.utils.datastructures import SortedDict
from .models import Revision, Ticket, TicketChange
from .models import Revision, Ticket, TicketChange, Attachment

_statfuncs = []

Expand Down Expand Up @@ -52,6 +52,10 @@ def new_tickets_reviewed(username):
qs = qs.exclude(newvalue='Unreviewed')
return qs.count()

@stat('Patches submitted')
def patches_submitted(username):
return Attachment.objects.filter(author=username).count()

def run_single_value_query(query, *params):
"""
Helper: run a query returning a single value (e.g. a COUNT) and return the value.
Expand Down

0 comments on commit a0422b0

Please sign in to comment.