def _process(self): rooms = sorted(self._location.rooms, key=lambda r: natural_sort_key(r.full_name)) kpi = {} if self._with_kpi: kpi['occupancy'] = calculate_rooms_occupancy( self._location.rooms.all()) kpi['total_rooms'] = self._location.rooms.count() kpi['active_rooms'] = self._location.rooms.filter_by( is_active=True).count() kpi['reservable_rooms'] = self._location.rooms.filter_by( is_reservable=True).count() kpi['reservable_capacity'] = (self._location.rooms.with_entities( func.sum( Room.capacity)).filter_by(is_reservable=True).scalar()) kpi['reservable_surface'] = (self._location.rooms.with_entities( func.sum( Room.surface_area)).filter_by(is_reservable=True).scalar()) kpi['booking_stats'] = compose_rooms_stats( self._location.rooms.all()) kpi['booking_count'] = Reservation.find( Reservation.room_id.in_( r.id for r in self._location.rooms)).count() return WPRoomBookingAdminLocation( self, location=self._location, rooms=rooms, action_succeeded=self._actionSucceeded, equipment_types=self._location.equipment_types.all(), attributes=self._location.attributes.all(), kpi=kpi).display()
def _process(self): rooms = sorted(self._location.rooms, key=lambda r: natural_sort_key(r.full_name)) kpi = {} if self._with_kpi: kpi['occupancy'] = calculate_rooms_occupancy(self._location.rooms) kpi['total_rooms'] = len(self._location.rooms) kpi['active_rooms'] = sum(1 for room in self._location.rooms if room.is_active) kpi['reservable_rooms'] = sum(1 for room in self._location.rooms if room.is_reservable) kpi['reservable_capacity'] = sum(room.capacity or 0 for room in self._location.rooms if room.is_reservable) kpi['reservable_surface'] = sum(room.surface_area or 0 for room in self._location.rooms if room.is_reservable) kpi['booking_stats'] = compose_rooms_stats(self._location.rooms) kpi['booking_count'] = Reservation.find( Reservation.room.has(Room.location == self._location)).count() return WPRoomBookingAdminLocation( self, 'rb-rooms', location=self._location, rooms=rooms, action_succeeded=self._actionSucceeded, equipment_types=self._location.equipment_types.all(), attributes=self._location.attributes.all(), kpi=kpi).display()
def _process(self): return WPRoomBookingRoomStats( self, room=self._room, period=self._occupancy_period, occupancy=calculate_rooms_occupancy([self._room], self._start, self._end), stats=compose_rooms_stats([self._room])).display()
def _process(self): return WPRoomBookingRoomStats( self, room=self._room, period=self._occupancy_period, occupancy=calculate_rooms_occupancy([self._room], self._start, self._end), stats=compose_rooms_stats([self._room]), ).display()
def _process(self): last_year = str(date.today().year - 1) last_month_date = date.today() - relativedelta(months=1, day=1) last_month = '{:d}-{:02d}'.format(last_month_date.year, last_month_date.month) return WPRoomBookingRoomStats(self, room=self._room, period=self._occupancy_period, last_year=last_year, last_month=last_month, occupancy=calculate_rooms_occupancy([self._room], self._start, self._end), stats=compose_rooms_stats([self._room])).display()
def _process(self): rooms = sorted(self._location.rooms, key=lambda r: natural_sort_key(r.full_name)) kpi = {} if self._with_kpi: kpi['occupancy'] = calculate_rooms_occupancy(self._location.rooms) kpi['total_rooms'] = len(self._location.rooms) kpi['active_rooms'] = sum(1 for room in self._location.rooms if room.is_active) kpi['reservable_rooms'] = sum(1 for room in self._location.rooms if room.is_reservable) kpi['reservable_capacity'] = sum(room.capacity or 0 for room in self._location.rooms if room.is_reservable) kpi['reservable_surface'] = sum(room.surface_area or 0 for room in self._location.rooms if room.is_reservable) kpi['booking_stats'] = compose_rooms_stats(self._location.rooms) kpi['booking_count'] = Reservation.find(Reservation.room.has(Room.location == self._location)).count() return WPRoomBookingAdminLocation(self, 'rb-rooms', location=self._location, rooms=rooms, action_succeeded=self._actionSucceeded, equipment_types=self._location.equipment_types.all(), attributes=self._location.attributes.all(), kpi=kpi).display()
def _process(self): rooms = sorted(self._location.rooms, key=lambda r: natural_sort_key(r.full_name)) kpi = {} if self._with_kpi: kpi['occupancy'] = calculate_rooms_occupancy(self._location.rooms.all()) kpi['total_rooms'] = self._location.rooms.count() kpi['active_rooms'] = self._location.rooms.filter_by(is_active=True).count() kpi['reservable_rooms'] = self._location.rooms.filter_by(is_reservable=True).count() kpi['reservable_capacity'] = (self._location.rooms.with_entities(func.sum(Room.capacity)) .filter_by(is_reservable=True).scalar()) kpi['reservable_surface'] = (self._location.rooms.with_entities(func.sum(Room.surface_area)) .filter_by(is_reservable=True).scalar()) kpi['booking_stats'] = compose_rooms_stats(self._location.rooms.all()) kpi['booking_count'] = Reservation.find(Reservation.room_id.in_(r.id for r in self._location.rooms)).count() return WPRoomBookingAdminLocation(self, location=self._location, rooms=rooms, action_succeeded=self._actionSucceeded, equipment_types=self._location.equipment_types.all(), attributes=self._location.attributes.all(), kpi=kpi).display()