<commit_before>from django.db.models import Q
from airmozilla.main.models import (
    Approval,
    Event,
    SuggestedEvent,
    EventTweet
)


def badges(request):
    if not request.path.startswith('/manage/'):
        return {}
    context = {'badges': {}}
    # Event manager badge for unprocessed events
    if request.user.has_perm('main.change_event_others'):
        events = Event.objects.filter(
            Q(status=Event.STATUS_INITIATED) |
            Q(approval__approved=False) |
            Q(approval__processed=False)
        ).distinct().count()
        if events > 0:
            context['badges']['events'] = events
    # Approval inbox badge<commit_msg>fixes bug 1181798 - exclude initiated events from manage badge<commit_after>from django.db.models import Q
from airmozilla.main.models import (
    Approval,
    Event,
    SuggestedEvent,
    EventTweet
)


def badges(request):
    if not request.path.startswith('/manage/'):
        return {}
    context = {'badges': {}}
    # Event manager badge for unprocessed events
    if request.user.has_perm('main.change_event_others'):
        events = Event.objects.filter(
            Q(status=Event.STATUS_SUBMITTED) |
            Q(approval__approved=False) |
            Q(approval__processed=False)
        ).exclude(
            status=Event.STATUS_INITIATED
        ).distinct().count()
        if events > 0:
            context['badges']['events'] = events
    # Approval inbox badge
{'fraction_non_alphanumeric': 0.11050477489768076, 'fraction_numerical': 0.006139154160982265, 'mean_word_length': 2.6044226044226044, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1773126', 'n_tokens_mistral': 450, 'n_tokens_neox': 419, 'n_words': 91}