def available_rooms(cls, date, num_employee, begin_meeting, end_meeting, permission, company, facility): """ :param date: :param num_employee: the participent in the room :param begin_meeting: :param end_meeting: :return: a list of all the room that have enough space >= available_spaces for a meeting on the given time """ available_rooms = [] rooms = Room.get_by_capacity(num_employee, company, facility, permission) for room in rooms: room_capacity = room.capacity room_schedule = Schedule.get_by_room_and_date(room._id, date) for sched in room_schedule: if room.intersection(begin_meeting, end_meeting, sched): room_capacity = room_capacity - len(sched.participants) if room_capacity >= num_employee: # this room is empty available_rooms.append(room) return available_rooms
def get_all_participants_in_facility(manager, facility_name): rooms = Room.get_by_facility(manager.company, facility_name) if rooms is None: return sum_visits = 0 for room in rooms: schedules = Schedule.get_by_room_and_date( room._id, datetime.now().strftime('%d/%m/%Y')) for sched in schedules: sum_visits += len(sched.participants) return sum_visits