<commit_before># -*- coding: UTF-8 -*-
import haystack

from django.core.management.base import BaseCommand, CommandError
from conference import models

from collections import defaultdict
from optparse import make_option

class Command(BaseCommand):
    """
    """
    option_list = BaseCommand.option_list + (
        make_option('--by-ticket',
            action='store_true',
            dest='by_ticket',
            default=False,
            help='list by ticket instead of person',
        ),
    )
    def handle(self, *args, **options):
        qs = models.Ticket.objects\
                    .filter(orderitem__order___complete=True)\
                    .exclude(fare__ticket_type='partner')\
                    .select_related('user', 'fare', 'p3_conference')

        buyers = defaultdict(list)
        names = defaultdict(list)
        non_conference_tickets = defaultdict(list)
        conference_tickets = []
        alien_tickets = []
        for t in qs.filter(fare__ticket_type='conference'):
            name = t.name or '%s %s' % (t.user.first_name, t.user.last_name)
            data = {
                'name': name,
                'ticket': t,
                'additional': [],
            }
            conference_tickets.append(data)
            buyers[t.user_id].append(data)
            names[name].append(data)
<commit_msg>filtro per eliminare i biglietti staff<commit_after># -*- coding: UTF-8 -*-
import haystack

from django.core.management.base import BaseCommand, CommandError
from conference import models

from collections import defaultdict
from optparse import make_option

class Command(BaseCommand):
    """
    """
    option_list = BaseCommand.option_list + (
        make_option('--by-ticket',
            action='store_true',
            dest='by_ticket',
            default=False,
            help='list by ticket instead of person',
        ),
        make_option('--no-staff',
            action='store_true',
            dest='no_staff',
            default=False,
            help='exclude staff tickets',
        ),
    )
    def handle(self, *args, **options):
        qs = models.Ticket.objects\
                    .filter(orderitem__order___complete=True)\
                    .exclude(fare__ticket_type='partner')\
                    .select_related('user', 'fare', 'p3_conference')
        if options['no_staff']:
            qs = qs.exclude(ticket_type='staff')

        buyers = defaultdict(list)
        names = defaultdict(list)
        non_conference_tickets = defaultdict(list)
        conference_tickets = []
        alien_tickets = []
        for t in qs.filter(fare__ticket_type='conference'):
            name = t.name or '%s %s' % (t.user.first_name, t.user.last_name)
            data = {
                'name': name,
                'ticket': t,
                'additional': [],
            }
            conference_tickets.append(data)
            buyers[t.user_id].append(data)
            names[name].append(data)

{'fraction_non_alphanumeric': 0.11523046092184369, 'fraction_numerical': 0.0013360053440213762, 'mean_word_length': 1.9624134520276955, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5613007', 'n_tokens_mistral': 855, 'n_tokens_neox': 826, 'n_words': 166}