<commit_before># -*- coding: UTF-8 -*-
import datetime
import os.path
from collections import defaultdict
from conference.models import Conference, AttendeeProfile
from django.conf import settings
from django.core.urlresolvers import reverse

def conference_ticket_badge(tickets):
    """
    vedi conference.settings.TICKET_BADGE_PREPARE_FUNCTION
    """
    conferences = {}
    for c in Conference.objects.all():
        conferences[c.code] = {
            'obj': c,
            'days': c.days(),
        }
    groups = {}
    qs = tickets\
            .filter(orderitem__order___complete=True)\
            .select_related('fare', 'p3_conference', 'orderitem__order__user__user')
    for t in qs:
        if t.fare.conference not in groups:
            groups[t.fare.conference] = {
                'plugin': os.path.join(settings.OTHER_STUFF, 'badge', t.fare.conference, 'conf.py'),
                'tickets': [],
            }
        p3c = t.p3_conference
        if p3c is None:
            tagline = ''
            days = '1'
            experience = 0
            badge_image = None
        else:
            tagline = p3c.tagline
            experience = p3c.python_experience
            tdays = map(lambda x: datetime.date(*map(int, x.split('-'))), filter(None, p3c.days.split(',')))
            cdays = conferences[t.fare.conference]['days']
            days = ','.join(map(str,[cdays.index(x)+1 for x in tdays]))
            badge_image = p3c.badge_image.path if p3c.badge_image else None
        if p3c and p3c.assigned_to:
            profile = AttendeeProfile.objects.get(user__email=p3c.assigned_to)
        else:<commit_msg>generazione badge, mi fido del queryset passato e non filtro per validità ordine<commit_after># -*- coding: UTF-8 -*-
import datetime
import os.path
from collections import defaultdict
from conference.models import Conference, AttendeeProfile
from django.conf import settings
from django.core.urlresolvers import reverse

def conference_ticket_badge(tickets):
    """
    vedi conference.settings.TICKET_BADGE_PREPARE_FUNCTION
    """
    conferences = {}
    for c in Conference.objects.all():
        conferences[c.code] = {
            'obj': c,
            'days': c.days(),
        }
    groups = {}
    qs = tickets\
            .select_related('fare', 'p3_conference', 'orderitem__order__user__user')
    for t in qs:
        if t.fare.conference not in groups:
            groups[t.fare.conference] = {
                'plugin': os.path.join(settings.OTHER_STUFF, 'badge', t.fare.conference, 'conf.py'),
                'tickets': [],
            }
        p3c = t.p3_conference
        if p3c is None:
            tagline = ''
            days = '1'
            experience = 0
            badge_image = None
        else:
            tagline = p3c.tagline
            experience = p3c.python_experience
            tdays = map(lambda x: datetime.date(*map(int, x.split('-'))), filter(None, p3c.days.split(',')))
            cdays = conferences[t.fare.conference]['days']
            days = ','.join(map(str,[cdays.index(x)+1 for x in tdays]))
            badge_image = p3c.badge_image.path if p3c.badge_image else None
        if p3c and p3c.assigned_to:
            profile = AttendeeProfile.objects.get(user__email=p3c.assigned_to)
        else:
{'fraction_non_alphanumeric': 0.11636363636363636, 'fraction_numerical': 0.009696969696969697, 'mean_word_length': 2.1986434108527133, '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': '5176943', 'n_tokens_mistral': 1043, 'n_tokens_neox': 1018, 'n_words': 224}