'Returns common SQL to leaderboard calls.'

@classmethod
def _leaderboard_query(cls, since=None, types=None):

    query = cls.objects.values_list('user__id', 'user__display_name').annotate(total=Sum('score')).exclude(user__groups__name__in=('No    Reviewer    Incentives', 'Staff', 'Admins')).order_by('-total')
    if (since is not None):
        query = query.filter(created__gte=since)
    if (types is not None):
        query = query.filter(note_key__in=types)
    return query
