from events.exceptions import InvalidEventException from utils import validate_positive_int from utils.logs import Logger logging = Logger.get_logger(__name__) class SeatRequestEvent: """ SeatRequest event """ def __init__(self, trxn_id, seats_count): self._txn_id = trxn_id self._seats_count = seats_count def get_txn_id(self): return self._txn_id def get_seats_count(self): return self._seats_count def to_dict(self): """ Returns: The event data in form of dict """ return dict(txnId=self.get_txn_id(), seatsCount=self.get_seats_count()) @classmethod def validate_event(cls, event): """ Validates the possible event string and returns event object
import numpy as np import re from models.exceptions import ClientError from utils import numpy_fillna from utils.constants import SeatStatus from models.availableseats import AvailableSeats from models.seatsrow import SeatsRow from models.unassignedseats import UnavailableSeats from models.seatslayout import SeatsLayout from models.seat import Seat from utils.logs import Logger from models.bookingrequests import BookingRequests import utils logging = Logger.get_logger() class Screen(object): """ A screen in theatre, it HAS seats layout, HAS UnavailableSeats (currenlty supports booked type) Like an ORM object """ def __init__(self, layout_config, name="default"): self._name = name self._layout = SeatsLayout() self._unavailable_seats = UnavailableSeats() seats_conf = layout_config.get(self._name).get("seats_matrix") self._init_layout(seats_conf) self._init_unavailable_seats(seats_conf) self._total_seats_count = self.get_layout().get_total_size()