Example #1
0
    def handle(self, *args, **options):
        event = options['event']
        layout = options['layout']
        r1, r2 = options['row1:row2'].split(':')
        c1, c2 = options['col1:col2'].split(':')
        session = options.get('session', '')

        layout = SeatLayout.objects.get(name=layout)
        event = Event.objects.get(slug=event)

        if session:
            sessions = Session.objects.filter(pk=session)
        else:
            sessions = Session.objects.filter(space__event=event, space__numbered=True)

        for s in sessions:
            for r in range(int(r1), int(r2)+1):
                for c in range(int(c1), int(c2)+1):
                    print(layout, r, c)
                    tsh = TicketSeatHold(type="R",
                                         client="ADMIN",
                                         session=s,
                                         layout=layout,
                                         seat='{}-{}'.format(r, c))
                    tsh.save()
Example #2
0
    def internal_ws_autoseats(self, client, session, amount, user):
        session = Session.objects.get(id=session)
        seats = search_seats(session, int(amount))
        data = {
            'action': 'autoseat',
            'session': session.id,
            'seats': seats,
        }

        for s in seats:
            layout = SeatLayout.objects.get(id=s['layout'])
            seat = '{}-{}'.format(s['row'], s['col'])

            d2 = {
                'action': 'hold',
                'session': session.id,
                'layout': layout.id,
                'row': s['row'],
                'col': s['col'],
            }
            sh = TicketSeatHold(client=user,
                                layout=layout,
                                seat=seat,
                                session=session)
            sh.save()
            self.server.send_message_to_all(json.dumps(d2))

        if not seats:
            data['error'] = _('Not found contiguous seats, please, select manually using the green button')

        self.server.send_message(client, json.dumps(data))
Example #3
0
    def handle(self, *args, **options):
        event = options['event']
        layout = options['layout']
        r1, r2 = options['row1:row2'].split(':')
        c1, c2 = options['col1:col2'].split(':')
        session = options.get('session', '')

        layout = SeatLayout.objects.get(name=layout)
        event = Event.objects.get(slug=event)

        if session:
            sessions = Session.objects.filter(pk=session)
        else:
            sessions = Session.objects.filter(space__event=event,
                                              space__numbered=True)

        for s in sessions:
            for r in range(int(r1), int(r2) + 1):
                for c in range(int(c1), int(c2) + 1):
                    print(layout, r, c)
                    tsh = TicketSeatHold(type="R",
                                         client="ADMIN",
                                         session=s,
                                         layout=layout,
                                         seat='{}-{}'.format(r, c))
                    tsh.save()
Example #4
0
    def internal_ws_autoseats(self, client, session, amount, user):
        session = Session.objects.get(id=session)
        seats = search_seats(session, int(amount))
        data = {
            'action': 'autoseat',
            'session': session.id,
            'seats': seats,
        }

        for s in seats:
            layout = SeatLayout.objects.get(id=s['layout'])
            seat = '{}-{}'.format(s['row'], s['col'])

            d2 = {
                'action': 'hold',
                'session': session.id,
                'layout': layout.id,
                'row': s['row'],
                'col': s['col'],
            }
            sh = TicketSeatHold(client=user,
                                layout=layout,
                                seat=seat,
                                session=session)
            sh.save()
            self.server.send_message_to_all(json.dumps(d2))

        if not seats:
            data['error'] = _(
                'Not found contiguous seats, please, select manually using the green button'
            )

        self.server.send_message(client, json.dumps(data))
Example #5
0
    def internal_ws_hold_seat(self, client, session, layout, row, col, user):
        session = Session.objects.get(id=session)
        layout = SeatLayout.objects.get(id=layout)
        data = {
            'action': 'hold',
            'session': session.id,
            'layout': layout.id,
            'row': row,
            'col': col,
        }

        if not session.is_seat_holded(layout, row, col):
            seat = row + '-' + col
            sh = TicketSeatHold(client=user, layout=layout, seat=seat,
                                session=session)
            sh.save()
            self.server.send_message_to_all(json.dumps(data))
        else:
            data['action'] = 'holded'
            self.server.send_message(client, json.dumps(data))
Example #6
0
    def internal_ws_hold_seat(self, client, session, layout, row, col, user):
        session = Session.objects.get(id=session)
        layout = SeatLayout.objects.get(id=layout)
        data = {
            'action': 'hold',
            'session': session.id,
            'layout': layout.id,
            'row': row,
            'col': col,
        }

        if not session.is_seat_holded(layout, row, col):
            seat = row + '-' + col
            sh = TicketSeatHold(client=user,
                                layout=layout,
                                seat=seat,
                                session=session)
            sh.save()
            self.server.send_message_to_all(json.dumps(data))
        else:
            data['action'] = 'holded'
            self.server.send_message(client, json.dumps(data))