예제 #1
0
    def get(self, request, *args, **kwargs):
        self.groundwork(request, args, kwargs)
        schedules = []

        for person in self.profiles:
            response = get_schedule(person.user_object,
                                    labels=[self.conference.conference_slug])
            if len(response.schedule_items) > 0 or len(self.profiles) == 1:
                ticket_items, role_items = get_checklist_items(
                    person, self.conference)
                schedules += [{
                    'person': person,
                    'bookings': response.schedule_items,
                    'ticket_items': ticket_items,
                    'role_items': role_items
                }]

        sorted_sched = sorted(
            schedules,
            key=lambda schedule: schedule['person'].get_badge_name())
        return render(
            request, 'gbe/report/printable_schedules.tmpl', {
                'schedules': sorted_sched,
                'conference_slugs': conference_slugs(),
                'conference': self.conference
            })
    def test_both_match(self):
        '''
            profile meets role and ticket
        '''
        teacher = PersonaFactory()
        booking = book_worker_item_for_role(teacher, self.role_condition.role)
        conference = booking.event.eventitem.get_conference()

        purchaser = PurchaserFactory(
            matched_to_user=teacher.performer_profile.user_object)
        transaction = TransactionFactory(purchaser=purchaser)
        transaction.ticket_item.ticketing_event.conference = conference
        transaction.ticket_item.ticketing_event.save()
        self.ticket_condition.tickets.add(transaction.ticket_item)
        self.ticket_condition.save()

        self.schedule = get_schedule(teacher.performer_profile.user_object,
                                     labels=[conference.conference_slug
                                             ]).schedule_items
        ticket_items, role_items = get_checklist_items(
            teacher.performer_profile, conference, self.schedule)
        nt.assert_equal(len(ticket_items), 1)
        nt.assert_equal(len(role_items), 1)
        nt.assert_equal(ticket_items[0]['ticket'],
                        transaction.ticket_item.title)
        nt.assert_equal(role_items[self.role_condition.role],
                        [self.role_condition.checklistitem])
예제 #3
0
    def test_no_checklist(self):
        '''
            profile matches no conditions
        '''
        no_match_profile = ProfileFactory()
        transaction = TransactionFactory()
        self.ticket_condition.tickets.add(transaction.ticket_item)
        ticket_items, role_items = get_checklist_items(
            no_match_profile, transaction.ticket_item.bpt_event.conference)

        nt.assert_equal(len(ticket_items), 0)
        nt.assert_equal(len(role_items), 0)
예제 #4
0
    def test_role_match(self):
        '''
            profile has a role match condition
        '''
        teacher = PersonaFactory()
        booking = book_worker_item_for_role(teacher, self.role_condition.role)
        conference = booking.event.eventitem.get_conference()

        ticket_items, role_items = get_checklist_items(
            teacher.performer_profile, conference)
        nt.assert_equal(len(role_items), 1)
        nt.assert_equal(role_items[self.role_condition.role],
                        [self.role_condition.checklistitem])
예제 #5
0
    def test_ticket_match(self):
        '''
            profile has a ticket match condition
        '''
        transaction = TransactionFactory()
        purchaser = ProfileFactory(
            user_object=transaction.purchaser.matched_to_user)
        conference = transaction.ticket_item.bpt_event.conference
        self.ticket_condition.tickets.add(transaction.ticket_item)
        self.ticket_condition.save()

        ticket_items, role_items = get_checklist_items(purchaser, conference)

        nt.assert_equal(len(ticket_items), 1)
        nt.assert_equal(ticket_items[0]['items'],
                        [self.ticket_condition.checklistitem])
    def test_no_checklist(self):
        '''
            profile matches no conditions
        '''
        no_match_profile = ProfileFactory()
        transaction = TransactionFactory()
        conf = transaction.ticket_item.ticketing_event.conference
        self.ticket_condition.tickets.add(transaction.ticket_item)
        no_schedule = get_schedule(no_match_profile.user_object,
                                   labels=[conf.conference_slug
                                           ]).schedule_items
        ticket_items, role_items = get_checklist_items(
            no_match_profile,
            transaction.ticket_item.ticketing_event.conference, no_schedule)

        nt.assert_equal(len(ticket_items), 0)
        nt.assert_equal(len(role_items), 0)
예제 #7
0
    def get(self, request, *args, **kwargs):
        self.groundwork(request, args, kwargs)
        schedules = []

        for person in self.profiles:
            response = get_schedule(
                person.user_object,
                labels=[self.conference.conference_slug])
            if len(response.schedule_items) > 0 or len(self.profiles) == 1:
                ticket_items, role_items = get_checklist_items(person,
                                                               self.conference)
                schedules += [{'person': person,
                               'bookings': response.schedule_items,
                               'ticket_items': ticket_items,
                               'role_items': role_items}]

        sorted_sched = sorted(
            schedules,
            key=lambda schedule: schedule['person'].get_badge_name())
        return render(request,
                      'gbe/report/printable_schedules.tmpl',
                      {'schedules': sorted_sched,
                       'conference_slugs': conference_slugs(),
                       'conference': self.conference})